+ Reply to Thread
Results 1 to 13 of 13

Xlookup help?

  1. #1
    Registered User
    Join Date
    01-12-2023
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Xlookup help?

    Hello. I don't understand the complete power of "xlookup" yet; I've previously been using Vlookup.

    (all data below is fictious)

    In Cell "AL3", I want Excel to grab the most recent "Aggregate ACB". All of the data (attached) below occurs in row 3 (imagine a very long, single row).

    In the scenario below, in cell "AL3", I want Excel to look across columns "E3:K3", "L3:R3", "S3:Y3", and "Z3:AF3" for the latest date, which is always found in the first column of each "group". Once that latest date is found, I want Excel to grab the "Aggregate ACB" from that "group" (the "6th" column in each "group").

    Is that possible? Does my explanation make sense?

    Thanks for your help!
    Attached Files Attached Files

  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 2406
    Posts
    44,662

    Re: Xlookup help?

    Please attach an Excel file.. not a word doc. This is an Excel forum, after all!!
    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

  3. #3
    Registered User
    Join Date
    01-12-2023
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Xlookup help?

    Excel file attached. Thanks.
    Attached Files Attached Files

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,350

    Re: Xlookup help?

    One way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    01-12-2023
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Xlookup help?

    It appears that Google Sheets does not allow the use of the "LET" function. Is there an alternative function to this?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,350

    Re: Xlookup help?

    Shame your profile says 365, you've posted in an Excel forum, and you mention Excel. What you don't mention is Google Sheets . Get rid of the LET(rng, E3:AF3, and the last bracket, and replace every occurrence of rng with E3:AF3

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,350

    Re: Xlookup help?

    As described, this works in Excel:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: Xlookup help?

    Alternative formula =INDEX(E3:AF3,MATCH(MAXIFS(E3:AF3,E$2:AF$2,"Date*"),E3:AF3,0)+5).

  9. #9
    Registered User
    Join Date
    01-12-2023
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Xlookup help?

    Quote Originally Posted by josephteh View Post
    Alternative formula =INDEX(E3:AF3,MATCH(MAXIFS(E3:AF3,E$2:AF$2,"Date*"),E3:AF3,0)+5).
    Thanks! Both those work perfectly.

    I have a follow-up question, if you don't mind:


    What if in Cell "AL3", I want Excel to grab the most recent "Aggregate ACB", but only from "group", "E3:K3", and "Y3:AF3"? In other words, the array is not a group of adjacent cells. I want Excel to only look at a certain set of cells.
    Your solution above worked because it simply looked at a "straight" array of "E3:AF3"; but not the array does not consist of single, adjacent group of cells.

    And sorry, I shouldn't keep using the word "Excel". This is in Google Sheets, which I thought was just Excel inside Google, but apparently not. This is because only Google Sheets has access to "=GOOGLEFINANCE( ...".

    Thanks!

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,350

    Re: Xlookup help?

    Your solution above worked because it simply looked at a "straight" array of "E3:AF3"; but not the array does not consist of single, adjacent group of cells.
    Yes, it does that because you said …
    In the scenario below, in cell "AL3", I want Excel to look across columns "E3:K3", "L3:R3", "S3:Y3", and "Z3:AF3" for the latest date, which is always found in the first column of each "group".
    It is not possible for us to anticipate all the possible variations that you might subsequently consider.

    I don't know Google Sheets so I don't know the best way to do this. In Excel 365, yes, GS, no.

    You might be able to use ArrayFormula to stack the two ranges and then index the dates but it's not something I can test … I don't have a Google Sheets spreadsheet to test it on. And that's not a hint to say that I want one, though someone else might.

  11. #11
    Registered User
    Join Date
    01-12-2023
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Xlookup help?

    Sorry, TSM. Typo in my above post. It should have said "EF:AF3"; but [what if] the array does not consist of a a single, adjacent group of cells?"
    Also, I should have re-phrased the opening few words of that sentence; I realize now that I may have come off sounding offensive - not my intent at all.

    Apologies. Your original formula works great and is fantastic. Thank you for providing it.

    All I intended to ask was: is there a way to slightly alter that formula that you provided, to be able to consider groups of cells that are non-adjacent, such as "E3:K3", and "Y3:AF3"?

    Thanks again for your help. Much appreciated.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,350

    Re: Xlookup help?

    Thinking about it …
    consider groups of cells that are non-adjacent, such as "E3:K3", and "Y3:AF3"
    In this example, you have just two ranges, two groups, two dates. So, logically, you just have to compare the dates and take the value which corresponds to the highest value.

  13. #13
    Registered User
    Join Date
    01-12-2023
    Location
    Canada
    MS-Off Ver
    365
    Posts
    6

    Re: Xlookup help?

    Ok. I was previously using the "IF" function but that only worked for two dates.

    What if, in cell "Q3" I want Excel to look at the range of cells "E3:K3", and "S3:AT3" for the MAX date, and then once that date is found, give me the value under column "Aggregate ACB" for that "group"?

    I tried using the "AND(" function inside of the previous formula but Excel didn't accept that. Something like: =INDEX(AND(E3:K3,S3:AT3),MATCH(MAXIFS(AND(E3:K3,S3:AT3),E$2:AF$2,"Date*"),E3:AF3,0)+5). But that didn't work.

    Basically, trying to make the formula look at a multiple, non-adjacent cells.

    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. [SOLVED] How to Use XLOOKUP In VBA
    By PosseJohn in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-30-2022, 01:50 PM
  2. [SOLVED] XLOOKUP gives N/A
    By Hexdax in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-23-2022, 04:06 AM
  3. [SOLVED] if and xlookup
    By pickslides in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-16-2022, 07:24 AM
  4. If this do this XLOOKUP otherwise do this XLOOKUP
    By MattKoleczko in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-21-2022, 08:14 AM
  5. [SOLVED] Xlookup in PQ
    By Excelski in forum Excel General
    Replies: 7
    Last Post: 09-09-2021, 07:15 AM
  6. Two-way Xlookup
    By Ballet4ever in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-28-2021, 10:11 PM
  7. [SOLVED] Xlookup with VBA, need some help!
    By CSimm in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-19-2021, 03:14 PM

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