## Excel Formula: Find Earliest Date and Latest Date for Each Group

In this tutorial, it provides formulas to find the earliest date and latest date for each group in Excel.

Generic formula:

Find the earliest date of each group

 {MIN(IF(group_rng=group,startD_rng))}

Find the latest date of each group

 {MAX(IF(group_rng=group,startD_rng))}

Syntaxt and Arguments

 Group_rng: the cell range that contains all group names. Group: the group whose earliest date and latest date you want to find out. StartD_rng: the cell range that contains all starting dates of the groups.

Return Value

The formulas return a date as a numeric value. Since the date is stored as number in Excel, to directly view the date, you can format the numeric value in a date format as you need after using the formula.

How this formula works

Here is a table, column B3:B8 contains department names, column C3:C8 contains the different project names in the departments, column D3:D8 is the start dates of each project, and the end dates of each group are in column E3:E8. For finding the earliest starting date and latest ending date from each department (A and B), please use below formula:

Find the earliest date

 =MIN(IF(\$B\$3:\$B\$8=B11,\$D\$3:\$D\$8))

Press Shift + Ctrl + Enter keys to get the correct array result.

Then drag the auto fill handle down to cells which need this formula.

Then keep the formula cells selected, press Ctrl +1 to display the Format Cells dialog, then under Number tab, click at Date in the Category list, then select one type of date from right Type section.

Click OK, now the results are displayed as dates.

Find the latest date for each department

 =MAX(IF(\$B\$3:\$B\$8=B11,\$E\$3:\$E\$8))

Press Shift + Ctrl + Enter keys, drag fill handle to apply the array formula to other cells as need, and format the cells as dates.

Explanation

IF function: tests for a specific condition.

In the array formula {IF(\$B\$3:\$B\$9=B11,\$D\$3:\$D\$8)}, it returns
{43597;FALSE;43952;43802;FALSE;FALSE;FALSE}

MIN function: to find the minimum value in a range or an array.

={MIN (IF(\$B\$3:\$B\$8=B11,\$D\$3:\$D\$8))}
={MIN(43597;FALSE;43952;43802;FALSE;FALSE)}
=43597

MAX function: to find the largest value in a range or an array.

={MAX(IF(\$B\$3:\$B\$8=B11,\$E\$3:\$E\$8))}
={MAX(44158;FALSE;44654;44013;FALSE;FALSE)}
=44684

Remark

If you are using Excel 2019 or Excel 365, you can use the MINIFS and MAXIFS functions to quickly find the earliest and latest dates of each group.

Generic Formula

Find earliest date for group

 MINIFS(startD_rng,group_rng,group)

Find latest date for group

 MAXIFS(startD_rng,group_rng,group)

Use the below formulas with above example:

 =MINIFS(\$D\$3:\$D\$8,\$B\$3:\$B\$8,B11)
 =MAXIFS(\$E\$3:\$E\$8,\$B\$3:\$B\$8,B11)

### The Best Office Productivity Tools

#### Kutools for Excel - Helps You To Stand Out From Crowd

 🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions… Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ... Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup... Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List... Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Columns to Select Same & Different Cells ... Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ... Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

#### Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

• One second to switch between dozens of open documents!
• Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
• Increases your productivity by 50% when viewing and editing multiple documents.
• Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.