Forum Discussion

nmlynch's avatar
nmlynch
Copper Contributor
Jan 24, 2024

Combining VLookup, max and other formulas to find customer's most recent visit - guidance?

Hello! Looking for some help with a formula - attaching an example spreadsheet with some simple data. My data are in two tabs - it needs to stay that way. On the second tab, I would like a formula that finds the name of the most recent visit date for each customer.

 

I will be honest - I have spent time reviewing multiple videos to try to piece this formula together. The concept seems simple enough to me where I feel like I should be able to do this. But...I realize it's a bit over my head. Asking for any assistance if you are able to help.

 

If it's just as easy, I'm attaching screenshots so you can see my data - identical to the attached Excel spreadsheet. I have no formulas in here because I am misunderstanding some key concepts in creating the formula.

 

Sincere thanks in advance!!

 

Nancy

6 Replies

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    nmlynch 

    I've heard rumors of VLOOKUP being obsolete! I think it's fine to use when you don't want to split the table array. Though in most cases XLOOKUP is a better option.

     

    Here's what a VLOOKUP solution looks like for this one:

    =LET(sorted, SORT('Raw Visit Data'!B3:D17, 3, -1), VLOOKUP(B3:B6, sorted, 2, 0))
  • nmlynch 

    =INDEX('Raw Visit Data'!$C$3:$C$17,MATCH(LARGE(IF(('Raw Visit Data'!$B$3:$B$17='Needed Output'!B3)*(NOT(ISBLANK('Raw Visit Data'!$D$3:$D$17))),'Raw Visit Data'!$D$3:$D$17),1),IF(('Raw Visit Data'!$B$3:$B$17='Needed Output'!B3)*(NOT(ISBLANK('Raw Visit Data'!$D$3:$D$17))),'Raw Visit Data'!$D$3:$D$17),0))

     

    You can try this formula which works with e.g. Excel 2013 as well. Enter the formula with ctrl+shift+enter if you don't work with Office 365 or Excel for the web or Excel 2021.

    • nmlynch's avatar
      nmlynch
      Copper Contributor

      Harun24HR - Fantastic! Thank you - it works beautifully. Clearly way more complicated than I'd envisioned. I'm very grateful for your help.

    • djclements's avatar
      djclements
      Bronze Contributor

      Harun24HR Nice use of the reference operator (@) to return the first result of the array, rather than TAKE(array, 1, 1). I like it! 🙂

Resources