+ Reply to Thread
Results 1 to 6 of 6

Need same Vlookup formula for use in different scenarios

  1. #1
    Registered User
    Join Date
    09-13-2011
    Location
    NYC
    MS-Off Ver
    Excel 2016
    Posts
    36

    Need same Vlookup formula for use in different scenarios

    Hello,
    I'm looking for a way to create a vlookup formula where the lookup value can be located in different spots in my data sets and still work.

    For example, in the attached I want to lookup the Age Value and pull in the Age Group based on the lookup table. However, the Age Column could shift to different columns based on the scenario, like in the second data set. I want to be able to use the same formula for both cases. I'm thinking an Index Match might work but I can't seem to figure it out.


    Thanks so much, this will save me so much time!
    Attached Files Attached Files
    Last edited by yankeekid86; 02-21-2022 at 07:38 PM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Need same Vlookup formula for use in different scenarios

    Is this what you mean??

    In N8, copied down:

    =IFERROR(VLOOKUP(INDEX($A$8:$M$20,ROWS(N$8:N8),MATCH("Age",$A$7:$M$7,0)),'Age Table'!$A:$B,2,1),"")
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    09-13-2011
    Location
    NYC
    MS-Off Ver
    Excel 2016
    Posts
    36

    Re: Need same Vlookup formula for use in different scenarios

    Yes, this worked in my example that I provided but now I'm trying to replicate it in my actual data set and getting an error. Can you confirm if this is the data I should be selecting?

    VLOOKUP(INDEX(range of data excluding header, ROWS(column to the left of formula first row:last row),MATCH("Age",range of data including header,0)),'Age Table'!$A:$B,2,1)

    Thanks

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Need same Vlookup formula for use in different scenarios

    not quite...

    =VLOOKUP(INDEX(range of data excluding header, ROWS(address of cell that the formula is IN*),MATCH("Age",range of data headers ONLY,0)),'Age Table'!$A:$B,2,1)

    * Pay attention to the $ signs. If the formula is in P14... it should read ROWS(P$14:P14)

  5. #5
    Registered User
    Join Date
    09-13-2011
    Location
    NYC
    MS-Off Ver
    Excel 2016
    Posts
    36

    Re: Need same Vlookup formula for use in different scenarios

    Got it! This worked. Thanks so much!

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Need same Vlookup formula for use in different scenarios

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link (just above the first post in the thread) and 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 returning for values that doesn't exist in the table lookup, other scenarios
    By dcwan in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-19-2019, 05:17 AM
  2. multiple scenarios in an if,iserror,vlookup formula.....
    By pugh616 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-02-2013, 10:17 AM
  3. [SOLVED] Formula help- what if scenarios.
    By simbalyon303 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-20-2012, 03:41 AM
  4. Multiple scenarios in one formula
    By scott2simpson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2011, 11:32 PM
  5. formula for 2 different scenarios
    By Montgomery in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2009, 05:48 PM
  6. Replies: 2
    Last Post: 09-12-2009, 01:58 AM
  7. and formula with 4 different scenarios
    By Ricardo9211 in forum Excel General
    Replies: 3
    Last Post: 08-15-2009, 07:15 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