# Tom’s Tutorials For Excel: Lookup Oldest and Newest Date

Tom’s Tutorials For Excel: Lookup Oldest and Newest Date

The picture shows one way of obtaining the oldest and newest dates in column B that correspond to the person’s name in column A that is in cell D2 as a lookup criteria. Because dates are numbers, you can use the `MIN` function for the oldest date, and the `MAX` function for the newest date.

The formula in cell E2 for the oldest date is `=MIN(IF(A2:A26=D2,B2:B26))`.
The formula in cell F2 for the newest date is `=MAX(IF(A2:A26=D2,B2:B26))`.

Array formulas are committed to a cell by pressing Ctrl+Shift+Enter, not just Enter.

###### 14 comments on “Tom’s Tutorials For Excel: Lookup Oldest and Newest Date”
1. sumit majumder says:

I need a details in excel that if i put an unique code than it will retrieve last date of visit excluding the current date & if unique code row is blank than return 0

A B
Reg. No Date
1000 17-Jan-18
1000 17-Jun-18
And if i put 1000 in A4 than result will come in C4 is 17-Jun-18

• Tom Urtis says:

`=IF(LEN(A4)=0,"",MAX(0,MAX(IF(A2:A3=A4,B2:B3))))`

This is an array formula, applied to a cell with `Ctrl+Shift+Enter`, NOT just with `Enter`.

2. sujit says:

how to find second min date and max date up to n …. numbers date

3. sujit says:

Hi Tom

tome 1st oldest date and newest date find that is (feb17,2011 and july09,2011) similar what about tome 2nd oldest date and newest date and which formula use to fined 3rd, 4th…..n number of Oldest and newest date to find.

• Tom Urtis says:

You can use this formula:
=LARGE(A1:A100,2) for the second largest (oldest)
=LARGE(A1:A100,3) for the third largest (oldest)
and so on.

4. Bryan says:

Thank you! Just what I was looking for.

5. Melissa says:

Hello, could you tell me what the formula is to look for the minimum date in a range but that particular date has to be after a certain date?

• Tom Urtis says:

With dates in range A2:A14 and an “after date” in cell C1, this array formula (Ctrl+Shift+Enter) should do what you want:
=MIN(IF(A2:A14>C1,A2:A14))

6. MMurphy says:

Hello,

What if I need to have the formula provide the value in D2(all unique values in column A) because there are too many to enter individually (as you have TOM listed in D2). I want the formula to provide the unique values from column A into my column D, rather than me manually inputting it. If that makes sense.

• Tom Urtis says:

Well, no, it does not exactly make sense because you wrote
“I want the formula to provide the unique values from column A into my column D”
when column D only shows in cell D2 what you want to find in column A.

I do not know what you want, maybe a unique list of names from column A to be listed somewhere, but in any case, more detail from you can help me understand what you want to end up with.

7. Pam Stazesky says:

Hi Tom,
How do you will down the column to get the oldest date for each person such as Bill, Bob, Mike, etc.? I know these names must be added to column D. I’m sure this simple, but I cannot figure it out. I just get my answer for my first line (Tom), but it puts Tom’s date for every single person.

• Tom Urtis says:

It could be done with a pivot table but to do it by a formula, actually two formulas, here are two pictures.

In the top picture, to list the unique names of people in column D the array formula in cell G2 and copied down as needed is
`=INDEX(\$D\$2:\$D\$18,MATCH(0,COUNTIF(\$G\$1:G1,\$D\$2:\$D\$18),0))`
And for anyone wondering, yes I know, Advanced Filter can do this too, but I used an array formula in this case because I felt like it.

In the bottom picture, to return each unique person’s oldest date, the array formula in cell H2 and copied down is
`=MIN(IF(\$D\$2:\$D\$18=G2,\$E\$2:\$E\$18))`
To get the newest date instead of the oldest date, simply change the `MIN` to `MAX`.
And for anyone wondering, yes I know about XLOOKUP, but I used an array formula in this case because I felt like it again.

Recall that these are array formulas. You apply them with `Ctrl+Shift+Enter`, not just with `Enter`.