简体   繁体   中英

Returning the most recent date when INDEX MATCH has multiple matches

I have an index match formula which goes through a list and returns a date based on an email address. My issue I have is what if there are multiple entries that match that email address? How do I return the most recent date?

eg worksheet 1 has all the data

A            B            C                 
email         ID            date

worksheet 2 has a list of specific email addresses i'm looking for info on

A         B
email   date

My formula in column B of worksheet 2 is along the lines of this:

index(worksheet1 C:C,match(worksheet2 A1, worksheet 1 A:A,false))

Basically saying where you find the email address in A1 listed in column A of worksheet 1, return in B1 the value in the column of that row in worksheet1.

The thing is we could have the same email address listed a number of times, so I'm looking for the latest date to be returned, not the first one it finds.

Thanks simon

You can try using DMAX Function
=DMAX(Sheet1!A1:C5,3,A1:A2)

Worksheet1:
工作表1

Worksheet2:
在此处输入图片说明

Here's more on DMAX Function .
If however you have a lot of emails in sheet 2 that you want to look-up, another approach is needed.

If that is the case, you can try this Array Formula .
=MAX(IF(Sheet1!$A$1:A$5=A3,Sheet1!$C$1:$C$5))
Above formula is entered by Ctrl + Shift + Enter in Cell B2 as shown below.

Result:
在此处输入图片说明

As you can see, it has the same result as the DMAX .
But you can copy and paste or auto-fill this formula to succeeding cells in B.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM