Available in:Excel 2013 or later (Works in Excel 2013, every later version, Microsoft 365 and Excel for the web)Examples need Excel 2021 or laterCategory:Date & time

DAYS

DAGEN in Dutch Excel

Counts the calendar days from a start date to an end date, returning a negative number when the end comes before the start.

Difficulty rating 1 of 5. Two dates and a subtraction; the one thing to learn is that the end date comes first, and that a reversed order gives a negative number.

Last updated: 13 October 2026

See the worked examples

Sheet excerpt: D2 holds the formula
RowABCD
1EntryInvoice datePosting dateDays to post
225-041218 Dec 202522 Dec 202544=DAYS(C2, B2)=DAYS(C2; B2)
325-041829 Dec 20256 Jan 2026
425-043130 Dec 202515 Jan 2026
Formula cell (D2)Input

Result: 4

=DAYS(C2, B2)
=DAYS(C2; B2)

What DAYS does and when to use it

What it does: it counts the calendar days from a start date to an end date, for example how many days an invoice has been open.

When to use it: for lead times, days late, invoice age and days to pay. It accepts only valid dates, so bad input shows an error. For working days use NETWORKDAYS.

How Excel evaluates it

Excel reads end_date, then start_date. If both are numbers, it checks that each lies within Excel's date range (serial numbers 1 to 2958465, which is 31 December 9999); a number outside it returns #NUM!. If an argument is text, Excel tries to read it as a date using the regional setting; if that fails, the result is #VALUE!.

Excel then subtracts: end_date - start_date. The result is positive when the end is later, 0 for the same day and negative when the end is earlier.

Watch out: DAYS takes the later date first: DAYS(end_date, start_date). Written in the order the columns appear, every duration comes out negative.

Mental model

A tape measure laid along the calendar, read from the far end back to the start: the far end is named first, and if you lay it the wrong way round the reading comes out negative.

Terms used on this page: serial number, argument, range

DAYS(end_date, start_date)
DAYS(end_date; start_date)
Arguments
ArgumentTypeMeaning
end_dateRequiredThe later date. It comes first, unlike most date functions.
start_dateRequiredThe earlier date the count starts from.

Return value:A number: the days from start_date to end_date

Formulas use commas (,) between arguments, as in English Excel. Formulas use semicolons (;) between arguments, as in Dutch Excel. Formulas use commas (,) between arguments, as in English Excel; Dutch Excel uses semicolons (;).

Worked examples

Beginner

Days between invoice date and posting date

You are testing cut-off in the XAF auditfile of Veldhuis Installatie BV. For each entry you want to know how many calendar days passed between the invoice date and the date the entry was posted, so you can pick out purchase invoices from December 2025 that were only booked in the new year.

Sheet excerpt: D2 holds the formula
RowABCDE
1EntryInvoice datePosting dateDays to post
225-041218 Dec 202522 Dec 202544=DAYS(C2, B2)=DAYS(C2; B2)
325-041829 Dec 20256 Jan 2026
425-043130 Dec 202515 Jan 2026
5
Formula cell (D2)Input

Formula in D2

=DAYS(C2, B2)
=DAYS(C2; B2)

Result: 44

Step by step
  1. Excel reads the first argument, end_date: C2, the posting date 22 December 2025, serial number 46013.
  2. It reads the second argument, start_date: B2, the invoice date 18 December 2025, serial number 46009.
  3. Both are valid dates, so Excel subtracts: 46013 - 46009 = 4. Entry 25-0412 was posted 4 days after the invoice date.
  4. Copied down, D3 returns 46028 - 46020 = 8 and D4 returns 46037 - 46021 = 16. Both of those invoices are dated in 2025 but posted in January 2026, so they belong on your cut-off list.

Watch out: Written as DAYS(B2, C2), in the order the columns appear, D2 shows -4. The size is right and only the sign gives the mistake away.

More on this example: why it works

Why it works

Dates are day counts, so the distance between two dates is a subtraction. DAYS does that subtraction with the later date first, which is why the answer is positive when you name the posting date before the invoice date.

Intermediate

Days late per debtor confirmation

You sent debtor confirmations at year end and are following up on the replies. For each customer you want the days between the reply deadline and the date the reply arrived: positive when the reply was late, negative when it was early.

Customers who have not replied yet should say so instead of showing a meaningless figure. The formula is copied down column D.

Sheet excerpt: D2 holds the formula
RowABCDE
1RelationReply deadlineReply receivedDays late
2D100123 Jan 202627 Jan 202644=IF(C2 = "", "Not received", DAYS(C2, B2))=IF(C2 = ""; "Not received"; DAYS(C2; B2))
3D100230 Jan 202627 Jan 2026
4D10036 Feb 2026
5D10046 Feb 20266 Feb 2026
6
Formula cell (D2)Input

Formula in D2

=IF(C2 = "", "Not received", DAYS(C2, B2))
=IF(C2 = ""; "Not received"; DAYS(C2; B2))

Result: 44

Step by step
  1. Excel evaluates the test first: C2 holds 27 January 2026, so C2 = "" is FALSE and IF moves to its third argument.
  2. DAYS(C2, B2) subtracts the deadline from the reply date: 46049 - 46045 = 4. Customer D1001 replied 4 days after the deadline.
  3. D3: reply on 27 January, deadline 30 January: 46049 - 46052 = -3. The negative number is the information: 3 days early.
  4. D4: C4 is empty, so the test is TRUE and IF returns Not received. Without IF, DAYS would read the blank as 0 and return a huge negative number that looks like data.
  5. D5: reply on the deadline itself, 46059 - 46059 = 0. On time.

Watch out: Averaging column D with AVERAGE skips the text Not received, which is right, but it also lets early replies cancel out late ones. Report late and early separately if that matters for your follow-up.

More on this example: why it works, 1 variation

Why it works

Putting the reply date first makes a late reply positive and an early one negative, so one column carries both. IF checks for a missing reply before DAYS runs, so the blank never reaches the calculation. No $ signs are needed, because each row reads only its own dates.

Variations

=IF(C2 = "", "Not received", C2 - B2)
=IF(C2 = ""; "Not received"; C2 - B2)

Plain subtraction gives the same numbers for real dates and works in versions before 2013, but it will not flag a malformed date.

AdvancedExcel 2021 or later (This example needs Excel 2021 or later)

Receivables aging buckets at year end

You reconcile the receivables aging list to the ledger at 31 December 2025. Every open invoice goes into an age band, counted in days since the invoice date and measured at the report date in G1:

  • 0-30
  • 31-60
  • 61-90
  • 91+

The band table sits in I1:J5 so the limits can be changed. An invoice dated after the report date is a cut-off error and must stand out.

Sheet excerpt: D2 holds the formula
RowABCDEFGHIJK
1InvoiceInvoice dateOpen amountAge bucketReport date31 Dec 2025From dayBucket
2F-609815 Oct 2025€980.00€ 980,0061-90=XLOOKUP(DAYS($G$1, B2), $I$2:$I$5, $J$2:$J$5, "Check date", -1)=XLOOKUP(DAYS($G$1; B2); $I$2:$I$5; $J$2:$J$5; "Check date"; -1)000-30
3F-612022 Dec 2025€1,450.00€ 1.450,00313131-60
4F-607129 Aug 2025€2,300.00€ 2.300,00616161-90
5F-61101 Dec 2025€1,100.00€ 1.100,00919191+
6F-60851 Nov 2025€750.00€ 750,00
7F-61333 Jan 2026€600.00€ 600,00
8
Formula cell (D2)InputNote: G1 holds a date: 31 December 2025.

Formula in D2

=XLOOKUP(DAYS($G$1, B2), $I$2:$I$5, $J$2:$J$5, "Check date", -1)
=XLOOKUP(DAYS($G$1; B2); $I$2:$I$5; $J$2:$J$5; "Check date"; -1)

Result: 61-90

Step by step
  1. Excel evaluates the inner DAYS first: end_date is the report date $G$1, 31 December 2025 (46022), and start_date is B2, 15 October 2025 (45945). 46022 - 45945 = 77 days.
  2. XLOOKUP looks for 77 in $I$2:$I$5 (0, 31, 61, 91) with match_mode -1: exact, or else the next smaller value. There is no 77, so it takes 61, the third cell, I4.
  3. It returns the third cell of $J$2:$J$5, which is J4: 61-90.
  4. Copied down:

    • F-6120 is 46022 - 46013 = 9 days, bucket 0-30
    • F-6071 is 124 days, 91+
    • F-6110 is exactly 30 days, still 0-30
    • F-6085 is 60 days, 31-60
  5. F-6133 is dated 3 January 2026, after the report date: 46022 - 46025 = -3. No bucket start is -3 or lower, so XLOOKUP returns Check date instead of a bucket.

Watch out: If the bucket starts are typed as 0, 30, 60 and 90, an invoice exactly 30 days old lands in 31-60 while its label promises 0-30. Nothing errors; the aging list is quietly off at every boundary and will not agree with the client's own specification.

More on this example: why it works, 1 more pitfall, 1 variation

Why it works

DAYS turns each invoice date into an age measured at one fixed report date, and the negative result for a future date is what makes the cut-off error visible. XLOOKUP with match_mode -1 then finds the highest bucket start that does not exceed the age, so only the bucket starts need to be stored. The $ signs keep the report date and the bucket table fixed while B2 moves down.

More to watch out for

  • Using TODAY() instead of $G$1 makes the buckets drift every day after you fix the working paper, so the figures no longer match the ledger at 31 December 2025.

Variations

=XLOOKUP($G$1 - B2, $I$2:$I$5, $J$2:$J$5, "Check date", -1)
=XLOOKUP($G$1 - B2; $I$2:$I$5; $J$2:$J$5; "Check date"; -1)

Subtraction instead of DAYS gives the same buckets for clean dates; DAYS is the safer choice when invoice dates come from an import.

MasterExcel 2021 or later (This example needs Excel 2021 or later)

Amount-weighted days to pay, settled invoices only

You assess how quickly Veldhuis Installatie BV's customer D1001 pays, as input for your view on the allowance for doubtful debts. A plain average treats a small invoice like a large one, so you want the days to pay weighted by amount, over settled invoices only; one invoice is still open.

The formula must handle the blank payment date explicitly and stay readable in the working papers.

Sheet excerpt: G1 holds the formula
RowABCDEFGH
1InvoiceInvoice datePaid onAmountWeighted days to pay39.0039,00=LET( invoiced, B2:B6, paid, C2:C6, amount, D2:D6, settled, ISNUMBER(paid), days, IF(settled, DAYS(paid, invoiced), 0), weight, amount * settled, SUM(days * weight) / SUM(weight) )=LET( invoiced; B2:B6; paid; C2:C6; amount; D2:D6; settled; ISNUMBER(paid); days; IF(settled; DAYS(paid; invoiced); 0); weight; amount * settled; SUM(days * weight) / SUM(weight) )
2F-54016 Oct 202510 Nov 2025€2,000.00€ 2.000,00
3F-540214 Oct 20257 Nov 2025€1,000.00€ 1.000,00
4F-540320 Nov 2025€1,500.00€ 1.500,00
5F-54043 Nov 202529 Dec 2025€3,000.00€ 3.000,00
6F-540517 Nov 202512 Dec 2025€2,000.00€ 2.000,00
7
Formula cell (G1)Input

Formula in G1

=LET(
  invoiced, B2:B6,
  paid, C2:C6,
  amount, D2:D6,
  settled, ISNUMBER(paid),
  days, IF(settled, DAYS(paid, invoiced), 0),
  weight, amount * settled,
  SUM(days * weight) / SUM(weight)
)
=LET(
  invoiced; B2:B6;
  paid; C2:C6;
  amount; D2:D6;
  settled; ISNUMBER(paid);
  days; IF(settled; DAYS(paid; invoiced); 0);
  weight; amount * settled;
  SUM(days * weight) / SUM(weight)
)

Result: 39.0039,00

Step by step
  1. LET names the three columns. settled is ISNUMBER(paid): TRUE, TRUE, FALSE, TRUE, TRUE. The blank payment date of F-5403 is not a number.
  2. days runs DAYS on each row, payment date first: 45971 - 45936 = 35, 45968 - 45944 = 24, 46020 - 45964 = 56, 46003 - 45978 = 25. For F-5403, IF returns 0 and whatever DAYS made of the blank is discarded. days is 35, 24, 0, 56, 25.
  3. weight multiplies the amounts by settled, where TRUE is 1 and FALSE is 0: 2000, 1000, 0, 3000, 2000. The open invoice no longer counts.
  4. The numerator: 35 × 2000 + 24 × 1000 + 0 + 56 × 3000 + 25 × 2000 = 70000 + 24000 + 168000 + 50000 = 312000.
  5. The denominator: 2000 + 1000 + 3000 + 2000 = 8000. The result is 312000 / 8000 = 39 days.
  6. The unweighted average of the four settled invoices is (35 + 24 + 56 + 25) / 4 = 35. The weighted figure is 4 days higher because the largest invoice, 3000, took the longest, 56 days.

Watch out: The mirror-image mistake is DAYS(invoiced, paid), start first as in NETWORKDAYS. The result is -39; wrapping it in ABS makes it look right but also hides any payment booked before its invoice date, a data error you want to see.

More on this example: why it works, 2 more pitfalls, 1 variation

Why it works

DAYS accepts whole columns and returns one duration per row, so the durations never need a helper column. settled acts twice: inside IF it keeps the blank payment date away from the result, and as a 1/0 multiplier it removes the open invoice from the weights.

Do not use this as a formal DSO figure, which relates the receivables balance to revenue over a period; this measures payment behaviour on settled invoices. When amounts are similar in size, the unweighted average in the variation is the alternative: simpler to explain, but blind to one large invoice paid late.

More to watch out for

  • Leaving out the IF and relying on weight alone is not enough: a blank payment date can make DAYS return an error or a huge negative number for that row, and 0 times an error is still an error.
  • If no invoice has been paid, SUM(weight) is 0 and the result is #DIV/0!. That is honest; do not hide it with IFERROR.

Variations

=AVERAGE(DAYS(FILTER(C2:C6, ISNUMBER(C2:C6)), FILTER(B2:B6, ISNUMBER(C2:C6))))
=AVERAGE(DAYS(FILTER(C2:C6; ISNUMBER(C2:C6)); FILTER(B2:B6; ISNUMBER(C2:C6))))

The unweighted average of the settled invoices, 35 days: FILTER removes the open row from both columns before DAYS runs.

Common mistakes

Common mistakes
SymptomCauseFix
Every duration is negativeEvery duration comes out negative.The arguments were written in start, end order, as in NETWORKDAYS. Swap them.
#NUM! on dates from an exportDAYS returns #NUM! on dates from an ERP export, while C2 - B2 on the same cells returns a large number.The export wrote dates as numbers such as 20260331, far beyond the last valid serial number. DAYS rejects them; subtraction does not. Convert them with DATE(LEFT(...), MID(...), RIGHT(...)) first.
A lead time is one day too shortA lead time is one day shorter than the team expects.DAYS counts the steps between the dates, so Monday to Friday is 4. If both the first and last day count, add 1, or use NETWORKDAYS for working days.