+ Reply to Thread
Results 1 to 14 of 14

Issue with the INDEX formula

  1. #1
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Issue with the INDEX formula

    Please help,

    I can't make my formula to work. I need to match in the Sheet "2012" in the row S the information from Sheet "Unloading" from the cells A, B and C.
    I need to see only the C row information(the amount in tons) in the S row, but it has to recognise the A row and B row.

    Very poor explanation i know, but i still hope someone can help me.

    Please, its urgent.
    Last edited by studio52; 03-14-2012 at 11:54 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,322

    Re: URGENT: Issue with the INDEX formula

    I'm not entirely sure what you are trying to do ... it's all Estonian to me

    However, on Sheet '2012' in cell S2

    =INDEX(Unloading!B$2:B$10000,MATCH($D2,Unloading!$A$2:$A$10000,0))

    ... will match the contents of cell D2 with column A on Sheet 'Unloading' and return the content of column B on Sheet 'Unloading'.

    Note that the INDEX column reference, B$2:B$10000, is "relative" so you can drag this across to return the content of column C.

    Also note that the search item in the MATCH, $D2, has a relative row reference meaning you can drag the formula down and it will auto adjust.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,705

    Re: URGENT: Issue with the INDEX formula

    Does this do what you want?

    =LOOKUP(2,1/(D2=Unloading!A$2:A$100)/(SUBSTITUTE(F2," ","")=Unloading!B$2:B$100),Unloading!C$2:C$100)

    It matches the column D value in the current row against column A in umloading sheet, and also column F value against column B in unloading sheet (although there's not an exact match so I used SUBSTITUTE to remove spaces) and then the formula returns the tonnes from the relevant row
    Audere est facere

  4. #4
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: URGENT: Issue with the INDEX formula

    Quote Originally Posted by daddylonglegs View Post
    Does this do what you want?

    =LOOKUP(2,1/(D2=Unloading!A$2:A$100)/(SUBSTITUTE(F2," ","")=Unloading!B$2:B$100),Unloading!C$2:C$100)

    It matches the column D value in the current row against column A in umloading sheet, and also column F value against column B in unloading sheet (although there's not an exact match so I used SUBSTITUTE to remove spaces) and then the formula returns the tonnes from the relevant row
    Unfortunately there is some kind of a error and i cannot explain where is it exactly.

  5. #5
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: URGENT: Issue with the INDEX formula

    This actually works, but not perfectly. I had to change the formula to be like that:

    =INDEX(Unloading!C$2:C$10000;MATCH($F2;Unloading!$B$2:$B$10000;0))

    But when its doing the calculation it is giving to all the calculated cells the same value. Unfortunately the formula you gave me was calculating the amonut of the tons wrong and i decided to link it better to the B row in Unloading sheet. But doesnt work anyway

    Any ideas what im doing wrong?

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,705

    Re: URGENT: Issue with the INDEX formula

    If you get the same results in all rows when you drag the formula down then you may have calculation set to "manual". Press F9 to re-calculate or set to automatic

    Tools > Options > Calculation

  7. #7
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: URGENT: Issue with the INDEX formula

    Its set to automatic but anyway calculates to all the same amount

    I have 1799 entries and it is showing some numbers only on those what have a space in the row B sheet 2012. It fails on the function to substitute the space in the B row. Any other chance?

  8. #8
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: URGENT: Issue with the INDEX formula

    I think it would be better if I show you the exact table im working with. I tried to put your formulas into it.

    Please have a look IPEC shipments2012 by Volodjka as per S+R2.xlsx

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,705

    Re: Issue with the INDEX formula

    Whta result are you expecting to get in S2? From your data it doesn't look like there is a match for either D2 or F2

  10. #10
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: Issue with the INDEX formula

    Sheet Unloading Cell C - Sheet 2012 Cell E. But has to be checked if the reference number in Sheet 2012 is equal to Cell B in Sheet Unloading.

    Some reference numbers repeat.

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,705

    Re: Issue with the INDEX formula

    Ok, I was hoping you would be more specific and tell me what result you expect to see in S2, e.g. "xyz" which is the value from cell ?? in your other sheet. I assume that the reference number is F2 - that's ЭД 943955 and I can't see a match for that anywhere in unloading sheet in column B

  12. #12
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: Issue with the INDEX formula

    Thank you guys for the help i appreciate it very much. Im sorry for the confusion and i think it will be a to difficult formula so i will try tomorrow to create a macro and see if it will work. If not i might come back to you

  13. #13
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: Issue with the INDEX formula

    Ok guys im back and still having this problem.

    Here it goes step by step:
    1. Sheet 2012 Row D has to match sheet Unloading Row A if match then(if no match ignore)
    2. Sheet 2012 Row F has to match sheet Unloading Row B if match then(if no match ignore)
    3. Sheet 2012 Row E - sheet Unloading Row C

  14. #14
    Registered User
    Join Date
    02-09-2010
    Location
    Tallinn, Estonia
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    42

    Re: Issue with the INDEX formula

    Than you for the help i figured the formula out.

    =IF(ISERROR(IF(OFFSET(INDIRECT("Unloading!B"&MATCH(D13;Unloading!$A$2:$A$67;0)+1);0;0)=F13;OFFSET(INDIRECT("Unloading!C"&MATCH(D13;Unloading!$A$2:$A$67;0)+1);0;0)-'2012 '!E13;""));" ";IF(OFFSET(INDIRECT("Unloading!B"&MATCH(D13;Unloading!$A$2:$A$67;0)+1);0;0)=F13;OFFSET(INDIRECT("Unloading!C"&MATCH(D13;Unloading!$A$2:$A$67;0)+1);0;0)-'2012 '!E13;""))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1