+ Reply to Thread
Results 1 to 5 of 5

lookup value based on two criteria

  1. #1
    Registered User
    Join Date
    08-23-2013
    Location
    Livingston, MT
    MS-Off Ver
    Excel 2010
    Posts
    3

    lookup value based on two criteria

    Hey folks. I want to lookup a date in a table based on two criteria: name and date. There are lots of non-unique (repeating) values in the name column. I want to lookup the date based on it being less than a given date. For example: In the data below I want the formula to return the most recent date less than or equal to 15-Feb for john. I want the formula to return 14-Feb. My actual data is sorted by date. It's a record of dates when a client was visited. Thanks in advance.

    john 13-Feb
    john 14-Feb
    beth 14-Feb
    peter 14-Feb
    leslie 16-Feb
    john 17-Feb

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: lookup value based on two criteria

    Welcome to the forum!

    Try this:

    Excel 2016 (Windows) 32 bit
    A
    B
    C
    D
    E
    1
    john
    13-Feb
    15-Feb
    John
    2
    john
    14-Feb
    3
    beth
    14-Feb
    14/02/2018
    4
    peter
    14-Feb
    5
    leslie
    16-Feb
    6
    john
    17-Feb
    Sheet: Sheet2

    Excel 2016 (Windows) 32 bit
    E
    3
    =LOOKUP(2,1/(($A$1:$A$6=E1)*($B$1:$B$6<=D1)),$B$1:$B$6)
    Sheet: Sheet2
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-23-2013
    Location
    Livingston, MT
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: lookup value based on two criteria

    You are my hero! Thank you! What does the 2 (the first argument) in the lookup formula do?

  4. #4
    Registered User
    Join Date
    08-23-2013
    Location
    Livingston, MT
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: lookup value based on two criteria

    Nevermind... found the answer... "If you use 2 as the lookup value, then the formula will match it with the last numeric value in the range, that is, the last row where both conditions are True."

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: lookup value based on two criteria

    Correct! And sorry I didn't see your question until just now. Glad to have helped!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Replies: 0
    Last Post: 05-02-2016, 07:59 AM
  2. [SOLVED] Lookup based on three criteria
    By IronCladRooster in forum Excel General
    Replies: 2
    Last Post: 10-15-2015, 02:27 PM
  3. [SOLVED] Lookup Based on 2 Criteria
    By Maroota in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-17-2012, 10:48 AM
  4. Lookup based on two criteria
    By Gillman in forum Excel General
    Replies: 7
    Last Post: 02-16-2010, 05:55 AM
  5. Lookup based on 2 criteria
    By L. S. Martin in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 07-16-2005, 05:14 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