We have a range of dates and we want to look up the earliest and the latest date based on certain criteria like the earliest date for a showing movie, we can use MIN and MAX functions with IF function or INDEX function together to find the matched date based on some criteria. Except using formula, we can also use PivotTable to find the min or max date.
See the table below. We have a list of entertainments in recent days. And we want to know the earliest date and latest date for certain entertainments.
Table of Contents
Find the Earliest Date Based on Criteria with Functions MIN & IF
Step 1: In E2 cell enter the formula =MIN(IF($A$2:$A$13=D2,$B$2:$B$13)).
Comment:
In above formula IF function returns the data satisfied the criteria $A$2:$A$13=D2, then MIN function returns the earliest date among the filtered dates.
Step 2: Press Ctrl+Shift+Enter to get the result. Verify that it returns a five digits number, so we need to convert it to date format.
Step 3: Click Home, in Number group, click General dropdown list and select Short Date.
Step 4: Verify that the five digits number is converted to date format properly.
Find the Latest Date Based on Criteria with Functions MAX & IF
Step 1: In E6 cell enter the formula =MAX(IF(A2:A13=D6, B2:B13)).
Step 2: Press Ctrl+Shift+Enter to get the result. Verify that it returns a five digits number, so we need to convert it to date format.
Step 3: Click Home, in Number group, click General dropdown list and select Short Date. Verify that number is converted to date format properly.
There is another way to find the latest date by functions MIN and INDEX. See method below.
Find the Latest Date Based on Criteria with Functions MIN & INDEX
Step 1: In E6 cell enter the formula =MAX(INDEX((D6=A2:A13)*B2:B13,)).
Step 2: Press Ctrl+Shift+Enter to get the result. We get the same 5 digits number in above method step#2. The we can follow previous steps#3-#4 to convert it to date format.
Video: Find the Earliest and Latest Date in Excel
SAMPLE Files
Below are sample files in Microsoft Excel that you can download for reference if you wish.
Related Functions
- Excel IF function
The Excel IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])…. - Excel INDEX function
The Excel INDEX function returns a value from a table based on the index (row number and column number)The INDEX function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the INDEX function is as below:= INDEX (array, row_num,[column_num])… - Excel MAX function
The Excel MAX function returns the largest numeric value from the numbers that you provided. Or returns the largest value in the array.= MAX(num1,[num2,…numn])… - Excel MIN function
The Excel MIN function returns the smallest numeric value from the numbers that you provided. Or returns the smallest value in the array.The MIN function is a build-in function in Microsoft Excel and it is categorized as a Statistical Function.The syntax of the MIN function is as below:= MIN(num1,[num2,…numn])….