+ Reply to Thread
Results 1 to 8 of 8

How to use XLOOKUP with a max Date criteria

  1. #1
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    How to use XLOOKUP with a max Date criteria

    Hello Gurus,

    I'm trying to use XLOOKUP to index data. Easy enough by itself. However, my data source has multiple rows of the same item number, each with Value Date and Values. How can i index the Value and the Value Date based on the latest Value Date. Please see attached sample file and result i want to achieve.
    Attached Files Attached Files
    Last edited by punksterz626; 05-28-2023 at 05:28 PM.

  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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: How to use XLOOKUP with a max Date criteria

    Try this:

    =LET(t,A1:C1,a,A2:C16,m,MAXIFS(C2:C16,A2:A16,A2:A16),VSTACK(t,FILTER(a,INDEX(a,,3)=m)))
    Attached Files Attached Files
    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
    05-26-2023
    Location
    New York
    MS-Off Ver
    Microsoft Office 16
    Posts
    5

    Re: How to use XLOOKUP with a max Date criteria

    Hey buddy -- I've attached what you wanted. It's also dynamic so one column can be copied and its formula can be pasted across the other two columns. Attached.punksters626.xlsx

    Formula below:

    =INDEX($A$2:$C$16,ROWS(MAX($C$2:$C$16)),COLUMNS($A$8:A8))
    Last edited by AliGW; 05-27-2023 at 12:43 AM. Reason: Please do NOT quote unnecessarily!

  4. #4
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: How to use XLOOKUP with a max Date criteria

    Quote Originally Posted by AliGW View Post
    Try this:

    =LET(t,A1:C1,a,A2:C16,m,MAXIFS(C2:C16,A2:A16,A2:A16),VSTACK(t,FILTER(a,INDEX(a,,3)=m)))
    Quote Originally Posted by UnderLeveraged View Post
    Hey buddy -- I've attached what you wanted. It's also dynamic so one column can be copied and its formula can be pasted across the other two columns. Attached.Attachment 830823

    Formula below:

    =INDEX($A$2:$C$16,ROWS(MAX($C$2:$C$16)),COLUMNS($A$8:A8))

    thank you for taking the time to reply and assist me. I think I may have been confusing in explaining what I want. So i have a list of Order Item and for each item I want to index the Value from Column B and the Value Date in column C. However, there are duplicate Order Item number in Column A. I want to index just the data row with the latest Value Date which would be the latest and greatest data currently. I've attached the sample i want for this formula.

    Thank you, again.
    Attached Files Attached Files

  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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: How to use XLOOKUP with a max Date criteria

    That's what my formula does, it just generates the whole table for you.

    If you want just those columns, try this:

    =LET(a,B3:C17,m,MAXIFS(C3:C17,A3:A17,A3:A17),FILTER(a,INDEX(a,,2)=m))
    Attached Files Attached Files
    Last edited by AliGW; 05-29-2023 at 02:54 AM. Reason: Workbook added.

  6. #6
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: How to use XLOOKUP with a max Date criteria

    But then again, maybe this is what you want (assuming you want the minimum value from the maximum dates):

    =LET(h,A2:C2,t,A3:C17,a,A3:A17,c,C3:C17,m,MAXIFS(c,a,a),f,FILTER(t,c=m),VSTACK(h,FILTER(f,INDEX(f,,2)=MIN(INDEX(f,,2)))))

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

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.
    Attached Files Attached Files
    Last edited by AliGW; 05-29-2023 at 03:08 AM. Reason: Workbook added.

  7. #7
    Registered User
    Join Date
    02-25-2022
    Location
    California, USA
    MS-Off Ver
    microsoft 365
    Posts
    32

    Re: How to use XLOOKUP with a max Date criteria

    Quote Originally Posted by AliGW View Post
    That's what my formula does, it just generates the whole table for you.

    If you want just those columns, try this:

    =LET(a,B3:C17,m,MAXIFS(C3:C17,A3:A17,A3:A17),FILTER(a,INDEX(a,,2)=m))
    not sure what im doing wrong, but the formula is not working for me. Some context, i dont need to create a brand new table. I have an existing table with a list of "Order Item" that I need to find the data for from the latest Value Date and the Value for that date for the Order Item. I'm thinking an index and match with a Date criteria would work.

  8. #8
    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. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: How to use XLOOKUP with a max Date criteria

    Could you provide a more realistic sample table for the results? I cannot see why that would not work for you, so you need to show me.

+ 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. Xlookup- Find the furthest out date based on a criteria
    By emmacl in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-23-2023, 12:14 AM
  2. Xlookup multiple criteria
    By mcis19 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-26-2023, 11:18 AM
  3. Xlookup functions with 2 criteria
    By kirana2014 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-22-2023, 09:26 PM
  4. Using XLOOKUP for 2 search criteria
    By santoma in forum Excel General
    Replies: 10
    Last Post: 01-13-2023, 03:12 PM
  5. [SOLVED] Xlookup for 2 criteria to search
    By Eric Tsang in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-20-2022, 12:42 PM
  6. Xlookup with multiple criteria
    By Mackay2m in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 01-12-2022, 04:09 PM
  7. Replies: 3
    Last Post: 06-24-2021, 10:31 AM

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