← All how-to recipes

How to find the earliest (or latest) date per category

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

The first order date per customer, the last activity per project — a min/max date filtered by group.

The formula

AppFormulaNotes
Excel (desktop)=MINIFS(B2:B6,A2:A6,"East")A = category, B = dates. MAXIFS for the latest. Format the result as a date.
Google Sheets=MINIFS(B2:B6,A2:A6,"East")Identical.
LibreOffice Calc=MINIFS(B2:B6,A2:A6,"East")Identical.

How it works

Because dates are just numbers, MINIFS finds the smallest (earliest) date among rows matching the category: the three East rows have dates 46229, 46210 and 46250, so the earliest is 46210 (format the cell as a date to read it). MAXIFS gives the latest date the same way. This is the standard 'first/last event per group' calculation — first purchase per customer, most recent login per user. MINIFS/MAXIFS need Excel 2019+ (they're in Google Sheets and LibreOffice); on older Excel use a MIN(IF(...)) array formula. To also return WHAT happened on that date, feed the result into INDEX/MATCH.

Verified, not just documented

We ran =MINIFS(B2:B5,A2:A5,"East") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 46210 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 46210 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

MINIFS — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes