+ Reply to Thread
Results 1 to 14 of 14

How to make Vlookup or return results that are not in the first column of the array?

  1. #1
    Registered User
    Join Date
    06-18-2014
    Location
    New York
    MS-Off Ver
    2013
    Posts
    11

    How to make Vlookup or return results that are not in the first column of the array?

    *QUESTION SOLVED by Jonmo1*

    Im trying to use Vlookup or Index/Match (or any other function) retrieve a value (in this example, 500) in an array, which is associated with a row label ("Supermarket") that is NOT in the left-most column ("Date", it is under "Category"). The array cannot be changed to make this row's column the first of the array.

    The table looks like this:

    Date / Category / Value

    Day 1 / Pet Expenses / 123
    Day 2 / Restaurant / 231
    Day 3 / Supermarket / 500
    Day 4 / Plants / 213

    There are arrays for every month. Since the supermarket row changes every month but the value column doesn't, I only need to make the row lookup flexible to change every month. The issue is that it is not on the left-most column. Could you please let me know if you have any suggestions? Many thanks!
    Last edited by c.mayer; 06-18-2014 at 07:52 PM. Reason: Solved

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Vlookup doesn't require the value to be in the 'absolute' leftmost column (As in column A)
    It requires the value to be in the leftmost columm 'of the referenced range'

    So
    =VLOOKUP("Supermarket",B:C,2,FALSE)
    In this formula, B is the leftmost column of the referenced range (B:C).

  3. #3
    Registered User
    Join Date
    06-18-2014
    Location
    New York
    MS-Off Ver
    2013
    Posts
    11

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Thanks for your fast reply. Unfortunately, as I mentioned, the objective is to not change the array (which covers A:C) because it is the object of many other formulas. Any ideas?

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Quote Originally Posted by c.mayer View Post
    Thanks for your fast reply. Unfortunately, as I mentioned, the objective is to not change the array (which covers A:C) because it is the object of many other formulas. Any ideas?
    I don't understand how this formula changes the array? It makes no sense at all.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    06-18-2014
    Location
    New York
    MS-Off Ver
    2013
    Posts
    11

    Re: How to make Vlookup or return results that are not in the first column of the array?

    To make things clear, I have a pre-defined array that cannot be changed. Every month there is a new array but it spans over those three columns always (some months will have more rows than others). The Vlookup (or any other formula) needs to reference a row value that is in a column in the middle of the array (not the left-most column). Is it possible to vlookup 500 in the example above by referencing the Supermarket cell that is in the second column of the array? Hope this clarifies it. Cheers

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,624

    Re: How to make Vlookup or return results that are not in the first column of the array?

    =VLOOKUP("Supermarket",B:C,2,FALSE)
    Goes down column B to find Supermarket. When found, it returns the value two columns over, counting column B as #1, it returns ----> 500

    If your data is not always in columns A - C, then you can use a MATCH to find the column with the header "Category"
    Last edited by protonLeah; 06-18-2014 at 05:54 PM.
    Ben Van Johnson

  7. #7
    Registered User
    Join Date
    06-18-2014
    Location
    New York
    MS-Off Ver
    2013
    Posts
    11

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Thanks for trying to help! The thing is that I need the array to span from A:C (ie. cannot change the formula to selectively pick from B:C). That's the true challenge of this question. Will be grateful to anyone who can help me crack this one!

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Try

    =INDEX(pre-defined-range,MATCH("Supermarket",INDEX(pre-defined-range,0,2),0),3)

    The 2 is the column # to find the match
    The 3 is the column to return a value from

  9. #9
    Registered User
    Join Date
    06-18-2014
    Location
    New York
    MS-Off Ver
    2013
    Posts
    11

    Re: How to make Vlookup or return results that are not in the first column of the array?

    You did it! THANK YOU that was genius!!!!!!!!!!!!!

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Maybe this...

    =VLOOKUP("Supermarket",INDEX(A:C,0,2):INDEX(A:C,0,3),2,0)

    Although, along with the others, I don't understand why you can't just use:

    =VLOOKUP("Supermarket",B:C,2,0)

    What makes you think you can't use that? Have you tried it?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  11. #11
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to make Vlookup or return results that are not in the first column of the array?

    How about

    =VLOOKUP("Supermarket",OFFSET(pre-defined-range,0,1),2,0)

  12. #12
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,624

    Re: How to make Vlookup or return results that are not in the first column of the array?

    1. "... The thing is that I need the array to span from A:C ...". You must understand that you do not have an "array". You have a range of cells that span three columns (in this case, A-C).
    2. Formulas do not rearrange worksheets.
    3. To use VLookup, YOU specify which column to find the search value in; you specify how many columns to move to the right, counting search column as #1.
    4. The left column of the VLookup range is NOT the left column of the worksheet. VLookup does not automatically look in column A just because it's the left edge of the worksheet.

    For instance in the "range of cells" below
    I
    J
    K
    L
    M
    1
    ID NUMBER
    FIRST NAME
    LAST NAME
    CITY
    STATE
    2
    257
    A
    AA
    X
    1
    3
    474
    B
    SS
    Y
    2
    4
    596
    C
    DEF
    W
    3

    To return the city based on the id you use:
    Please Login or Register  to view this content.
    from the same data range use
    Please Login or Register  to view this content.
    to return the state base on the last name
    Notice that, in the first case the left column is "I" and in the second, it's "K".
    Last edited by protonLeah; 06-18-2014 at 07:59 PM.

  13. #13
    Registered User
    Join Date
    06-18-2014
    Location
    New York
    MS-Off Ver
    2013
    Posts
    11

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Tony thanks a lot, that is identical to Jonmo1's solution above. Question is now finally solved- thanks for your input!

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to make Vlookup or return results that are not in the first column of the array?

    Good deal. Thanks for the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] vlookup: search for value in SECOND column of table array and return value from FIRST
    By matt_pl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-28-2014, 06:02 AM
  2. How can I make VLOOKUP return nothing at all if column index is blank?
    By gibson2503 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-19-2013, 09:25 AM
  3. [SOLVED] Lookup to return multiple results - without array
    By ZeDoctor in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-22-2012, 07:42 AM
  4. average array formulae return different results
    By penfold in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-24-2012, 08:31 AM
  5. Formula/Array to return results in a certain range
    By B_Riz in forum Excel General
    Replies: 7
    Last Post: 01-31-2011, 02:12 PM

Tags for this Thread

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