How to calculate days overdue in Excel
Formula (Excel and Google Sheets)
=MAX(0,IF(C2="",$G$1,C2)-B2)Count from the due date to the paid date, or to today if unpaid, and floor it at zero: =MAX(0,IF(C2="",$G$1,C2)-B2).
- Result on the example
- one result per row in
D2, filled down toD7 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in D2, filled down to D7. Change any input and the result updates, or edit the formula to experiment.
How it works
An invoice is late by the days between its due date and the day it was paid, or the as-of date in G1 if it's still open. IF picks the right end date, and MAX(0, …) turns invoices paid early or not yet due into 0 instead of a negative number.
=MAX(0,IF(C2="",$G$1,C2)-B2)Result0
C29/12/2026The value in C2.
C2=""FALSEThe = operator tests whether the two sides are equal.
$G$110/29/2026not usedThe value in G1.
IF(C2="",$G$1,C2)46277IF: Returns one value if a test is true, another if false.- logical_test
C2=""FALSE - value_if_true
$G$110/29/2026not used - value_if_false
C29/12/2026
- logical_test
B29/15/2026The value in B2.
IF(C2="",$G$1,C2)-B2-3The - operator subtracts.
MAX(0,IF(C2="",$G$1,C2)-B2)0MAX: Largest number.- number1
0 - number2
IF(C2="",$G$1,C2)-B2-3
- number1
In Google Sheets
The same formula works in Google Sheets: =MAX(0,IF(C2="",$G$1,C2)-B2). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =IF(C2="",MAX(0,$G$1-B2),MAX(0,C2-B2)) | 0, 14, 19… | The same logic written out for each case, if your team finds it easier to read. |
| =MAX(0,$G$1-B2) | 44, 29, 19…Different result | Ignores the paid date. Use it only on a list of open invoices. Paid invoices keep counting. |
Common mistakes
- Without MAX, invoices paid early or not yet due show negative overdue days, which pulls averages down.
- A blank paid date counts as 0, so
C2-B2on an unpaid invoice gives a huge negative number. Test for "" first, as here. - Keep the as-of date in one cell and lock it with $. Put
=TODAY()there for a live report.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Calculate days overdue
D2, calculate how many days each invoice was or is overdue: up to the paid date, or up to the date in G1 if it is unpaid. Show 0 for invoices that aren't late. Fill down to D7.Questions
How do I count working days overdue?
Use NETWORKDAYS from the day after the due date: =MAX(0,NETWORKDAYS(B2+1,IF(C2="",$G$1,C2))).
How do I flag invoices more than 30 days overdue?
=IF(D2>30,"Escalate",""), or group them into aging buckets.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.