+ Reply to Thread
Results 1 to 11 of 11

Look into an array and return the same row in another column

  1. #1
    Registered User
    Join Date
    07-24-2007
    Posts
    9

    Look into an array and return the same row in another column

    Hi all,

    I have an array with a lot of rows and columns filled with different codes.

    I need to look into this array for one specific number and return the value in the same row in an specific column.

    I can't use Vlookup in this case because it needs to have the values you are looking for in the first column and my values are spread in different columns.

    Thanks in advance.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You can use Index/Match as an alternative to Vlookup that will look left or right of the lookup column.

    e.g. =Index(A:A,Match(X1,C:C,0))

    where X1 is the value to find in column C and return the corresponding data from column A
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    07-24-2007
    Posts
    9
    Thanks for the reply NBVC.

    But the problem I have is I have to look for in an array, not in a column and Vlookup or the formula you provided me with don't work. To use these formulas you have to have the values in one column and I have them spread in an array.

    Thanks anyway, I've learnt another way to do it.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by cmt_london
    Thanks for the reply NBVC.

    But the problem I have is I have to look for in an array, not in a column and Vlookup or the formula you provided me with don't work. To use these formulas you have to have the values in one column and I have them spread in an array.

    Thanks anyway, I've learnt another way to do it.


    Perhaps its best if posted an example (a zipped XL 2003 or earlier file) showing what exactly your are trying to do and what results you expect..

  5. #5
    Registered User
    Join Date
    07-24-2007
    Posts
    9
    Find attached the example file.

    There is an array A1:D4 with all the numbers and codes.

    And there is a list of numbers A8:A16.

    I need a formula in B8 that look for the number 810844 in the array A1:D4 and return the value in the column D of the same row, in this case AAA.

    And the same for the cells B9 to B16.

    Do you understand where I get stuck? Your formula or the Vlookup one will work if all numbers will be in the same column, but not if they are in different columns.

    Thanks,

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    The file didn't attach...

    make sure it is zipped and that you click Upload after you select the file to attach.

  7. #7
    Registered User
    Join Date
    07-24-2007
    Posts
    9
    Can you see it now?

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    okay...i'll take a chance and hope that I know what you are looking for....

    see attached.

    formula in B8 copied down is:
    Please Login or Register  to view this content.
    this will look for the number in A8 within the array A1:C4 and return the value in column D that corresponds with the row number the match is found in.

    Is this what you were after?
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-24-2007
    Posts
    9
    NVBC that's exactly what I needed.

    Thanks very much.

  10. #10
    Registered User
    Join Date
    07-24-2007
    Posts
    9
    Hi NVBC,

    I manage to get your formula working when the values in the array $D$1:$D$4 (where the returning values are) are typed numbers.

    Actually I've got these values as a formula like this:

    LEFT(A1,6)

    Because I've got those codes in the column A with more caracters.

    The thing is your formula works if I type the values manually for the array $D$1:$D$4 but if I populate this array with LEFT() formula it doesn't.

    Do you know why it could be?

    Thanks for all your supporting.

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If those formulas are in D1:D4, the indexed array, it should work properly and return the values no matter if you type them in directly or if you use a formula...

    ...however, Left(A1,6) does return a text string which will not be the same as an entry that is entered as a number (General format)....

    so try changing your =Left(A1,6) formula to =Left(A1,6)+0 this will convert the string to a real number....

    Hopefully that helps.

+ 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