Formualizer Docs

DAYS

Returns the number of whole days between two date serial values.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=DAYS(end_date, start_date)

Arguments

ArgumentTypeRequiredDefault
end_datenumberRequired—
start_datenumberRequired—

Remarks

  • A date argument may be text holding a date or time ("10/26/1999", "1999-10-26 14:05"), read as its serial; text that is neither a number nor a date returns #VALUE!.
  • Result is end_date - start_date; negative results are allowed.
  • Fractional serial inputs are truncated to their date portion.
  • Serials are interpreted with the workbook's date system (Excel 1900 or Excel 1904).
  • In the Excel 1900 system the historical leap-year quirk applies; the Excel 1904 system has no phantom leap day.

Examples

Count the days across February 29 in a leap year.

Formula =DAYS(DATE(2024,3,1),DATE(2024,2,28))

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Reverse the order to get a signed day difference.

Formula =DAYS(DATE(2024,2,28),DATE(2024,3,1))

Expected result -2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Identical serials have no elapsed days.

Formula =DAYS(45000,45000)

Expected result 0

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The end date cannot be read from this text.

Formula =DAYS("invalid",45000)

Expected result #VALUE!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Positive day difference

Formula =DAYS(45366, 45323)

Expected result 43

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Negative day difference

Formula =DAYS(45323, 45366)

Expected result -43

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Does DAYS count partial-day time fractions?

No. DAYS truncates both serial inputs to whole dates before subtracting end_date - start_date.

Implementation

Engine source

On this page