DAYS
Short answer
Prorate contracts by day and age receivables
DAYS(end_date, start_date)
- Category
- Dates & Fiscal Calendars
- Excel version
- 2013+
- Also searched as
- days between dates, number of days, day count, days past due, prorate by days, overlap days
What it returns
DAYS returns the number of days from start_date to end_date. =DAYS("31-Mar-2026", "1-Jan-2026") returns 89.
Note the order: end date first. Almost every other date function in Excel, including YEARFRAC, DATEDIF and EDATE, takes the start date first. Reverse the arguments in DAYS and you get -89, with no error to warn you.
For two real dates, DAYS gives the same answer as subtracting one from the other. What it adds is a stated intent, and it accepts dates written as text, which it converts as DATEVALUE would.
It counts the days between, not the days inclusive. A period from 1 January to 31 January returns 30. If the question is how many days of service fall in January, the answer is 31, and you add one.
Arguments that matter
| Argument | Required | What it does |
|---|---|---|
end_date | Yes | The later date. First argument, unlike other date functions. |
start_date | Yes | The earlier date. If it is later than end_date, the result is negative. |
- A date argument that is text Excel cannot parse returns
#VALUE!. - A number outside Excel’s valid date range returns
#NUM!. - Text dates are parsed using the machine’s regional settings, so “03/04/2026” means 4 March on a US-format system and 3 April on a UK one. Keep dates as real date values.
In a financial model
Most finance uses of a day count fall into two groups.
Aging. Days past due on a receivable, days a purchase order has been open, days since the last price change. =DAYS(ReportDate, [@DueDate]) in an open-items Table, then COUNTIFS or SUMIFS on that column to build the buckets.
Daily proration. Revenue recognized ratably, insurance and rent prepaids, a contract that starts mid-month. Each monthly column receives the share of the contract value equal to the days of service in that month over the days in the whole term. Daily proration is what most revenue policies mean by “ratably”, and it is the method that ties to the day.
The proration needs one more pattern: the overlap between the contract’s dates and each month. That is the worked example below. The spread should always sum back to the contract value, and that total belongs in the check row per build a check row and make it loud.
Worked example
A $120,000 annual contract running from 15 February 2026 to 14 February 2027. Contract start in C5, end in D5, value in E5. Month-start dates run across row 3 from column G and month-end dates across row 4, both real dates built with EOMONTH.
Days in the full term, inclusive:
=DAYS($D5, $C5)+1
That returns 365.
Days of service in the month in column G:
=MAX(0, DAYS(MIN($D5, G$4), MAX($C5, G$3))+1)
The later of the two starts and the earlier of the two ends bound the overlap. If the contract does not touch the month, the inner result is zero or negative and MAX returns 0.
Revenue for the month:
=$E5 * MAX(0, DAYS(MIN($D5, G$4), MAX($C5, G$3))+1) / (DAYS($D5, $C5)+1)
| Month | Days of service | Revenue |
|---|---|---|
| Feb 2026 | 14 | $4,602.74 |
| Mar 2026 | 31 | $10,191.78 |
| Apr 2026 to Jan 2027 | 30 or 31 each | $9,863.01 or $10,191.78 |
| Feb 2027 | 14 | $4,602.74 |
| Total | 365 | $120,000.00 |
The check: the row total, across columns G to S for February 2026 through February 2027, equals the contract value.
=ROUND(SUM($G5:$S5)-$E5, 2)
It should read zero. If it does not, the month columns do not cover the whole term, or the end date was not made inclusive.
Old way vs new way
The common shortcut spreads the contract evenly by month:
=$E5/12
That puts $10,000 in February 2026 for two weeks of service and leaves the final half-month in the wrong year. The daily version follows the service dates:
=$E5 * MAX(0, DAYS(MIN($D5, G$4), MAX($C5, G$3))+1) / (DAYS($D5, $C5)+1)
Where it breaks
Every number is negative. The arguments are in start-first order, as in YEARFRAC. Fix: end date first. If a column of results is uniformly negative, this is almost always the cause.
The spread is short by one day per contract. The day counts were not made inclusive, so a full-year contract counts 364 days and each month loses a day at one edge. Fix: add one to both the overlap and the term, as above, and test with the check row.
Results change on a colleague’s machine. Dates arrived as text and DAYS parsed them under different regional settings. Fix: convert text dates to real dates when the data is loaded, so the formula never sees text.
A contract with no end date breaks the row. An evergreen contract leaves D5 blank, and DAYS treats the blank as day zero, which returns a large negative number. Fix: fill open-ended contracts with the model’s horizon date, or wrap the end date in an IF that substitutes it, and label that assumption.
Working days were needed. DAYS counts calendar days. Payment terms stated in business days, or staffing calculations, need NETWORKDAYS.INTL with a holiday list instead.
Related functions
- EDATE. Builds the contract end date from a start date and term, the input to the day count.
- EOMONTH. Builds the month-start and month-end boundaries the overlap formula tests against.
- YEARFRAC. Converts the same dates into a fraction of a year under a named day count convention.
- COUNTIFS. Turns a days-past-due column into aging bucket counts.
- SUMIFS. Turns the same column into aging bucket balances.
- The play build a check row and make it loud is where the sum-back test belongs.
