# How to compare two dates and flag late deliveries in Excel

Check for a missing date first, then compare: =IF(C2="","Not delivered",IF(C2>B2,"Late","On time")).

**Excel:** `=IF(C2="","Not delivered",IF(C2>B2,"Late","On time"))` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D |
| --- | --- | --- | --- |
| PO | Promised | Delivered | Result |
| PO-771 | 2026-09-04 | 2026-09-03 |  |
| PO-772 | 2026-09-10 | 2026-09-14 |  |
| PO-773 | 2026-09-12 | 2026-09-12 |  |
| PO-774 | 2026-09-18 | 2026-09-25 |  |
| PO-775 | 2026-09-22 |  |  |
| PO-776 | 2026-09-30 | 2026-09-29 |  |

Formula in D2, filled to D7: `=IF(C2="","Not delivered",IF(C2>B2,"Late","On time"))`

Result: On time; Late; On time; Late; Not delivered; On time

## How it works

The first IF catches the empty delivery date. An empty cell counts as 0, which is earlier than any date, so without this test PO-775 would show "On time". The second IF compares the two dates: a later date is a larger number. Delivery on the promised day counts as on time.

## Other ways

- `=IF(C2="","Not delivered",IF(C2-B2>0,C2-B2&" days late","On time"))`: Says how late, by subtracting the dates. (Shows "4 days late" and "7 days late" instead of "Late".)
- `=IFS(C2="","Not delivered",C2>B2,"Late",TRUE,"On time")`: IFS lists the cases in order without nesting. Excel 2019 and later, and Google Sheets.

## Common mistakes

- Skipping the blank check marks undelivered orders as on time.
- Dates with times attached make a same-day delivery at 3 PM "later" than a promised date at midnight. Compare `INT(C2)` when times are present.

## Questions

**How do I calculate days late, with 0 for early deliveries?**

Use MAX: `=IF(C2="","",MAX(0,C2-B2))`.

**How do I count late deliveries?**

Compare the columns row by row: `=SUMPRODUCT((C2:C7<>"")*(C2:C7>B2:B7))`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/compare-two-dates-flag-late
