Why Excel's DAYS Function Returns a Negative Date Difference: Detecting Reversed Start and End Dates

VBA・Officeカテゴリを表すパンダのイラスト VBA / Office

About This ArticleThis article was generated using an automated generation workflow powered by generative AI. We verified the specifications of the official Microsoft DAYS function and cross-checked expected results using hypothetical dates.

Verification Status: Official Information Confirmed, Excel Device Testing Not Performed

Supported Environments and Limitations (Official Information Verification Date: November 28, 2026)

ItemCurrent Conditions
TargetExcel for Microsoft 365, Excel 2024, and Excel for the web. Among the official applicable products, those assumed in this article
WorkspaceAn empty sheet in a newly created editable workbook. On desktop, local saving can also be tested
License and PermissionsThe ability to edit workbooks in the utilized Excel environment. Samples do not contain macros, add-ins, or external connections
Handled DataHypothetical dates without times. Calculates calendar day differences including weekends
Verification ScopeConfirmed expected values of date differences through calculation. Excel recalculation and screen display unverified

Why Excel's DAYS Function Returns a Negative Date Difference: Detecting Reversed Start and End Dates

When calculating elapsed days from project start and end dates in Excel, a negative day count serves as a clue to inspect both inputs and formulas. For instance, if the start date is November 10 and the end date is November 12, the date difference is 2 days. If the end date is set to November 9, the difference becomes -1 day. Mechanically converting negative values to positive ones can inadvertently mix rows with inverted dates into your aggregation. Therefore, retain the sign of the difference first to identify rows that require review.

Check the difference using three rows of work records

List the item names starting from A1 to the left. Set column A as 'Task', column B as 'Start Date', column C as 'End Date', column D as 'Date Difference', and column E as 'Check'. To avoid dates being treated as text, enter the following formulas in columns B and C for practice. If only numbers appear, apply the date format to columns B and C.

RowColumn AColumn BColumn C
2Inspection A=DATE(2026,11,10)=DATE(2026,11,12)
3Inspection B=DATE(2026,11,10)=DATE(2026,11,10)
4Inspection C=DATE(2026,11,10)=DATE(2026,11,9)

In D2, =DAYS(C2,B2)and in E2, =IF(D2<0,"要確認","") and type it, then copy down to the fourth row for each. The expected values in column D from the top are 2、0、-1. In column E, only the last row displays "Needs Review". Setting column D to the General or Number format makes it easier to distinguish from date-like displays.

In the official Microsoft DAYS syntax, the end date is the first argument and the start date is the second argument. If dates are entered as serial numbers, the result is the end date minus the start date. Inspection B is 0 because both dates are the same. The negative value for Inspection C indicates that the end date precedes the start date. The "Needs Review" label here does not identify a specific cause; it serves as a signal for staff to verify the entered dates and formula arguments.

Changing only the end date

Change C4 to =DATE(2026,11,13). Do not modify B4. It is expected that D4 changes from -1 to 3, and E4 changes from "Needs Review" to blank. If D4 becomes -3 at this point, open the formula bar for D4 and check whether the formula is set to =DAYS(B4,C4). If the result in D2 is also negative, correcting the source formula makes it easier to trace across the entire range. If only a single row is negative, check the date and cell references for that row first.

Distinguishing elapsed days from inclusive days

The date difference from November 10 to November 12 is 2 days, but some operations cover the 3-day span of the 10th, 11th, and 12th. The former represents elapsed date differences, while the latter represents the count of calendar days inclusive of both endpoints. If inclusive counting is required, verify the order of the start and end dates, and add 1 to the non-negative difference. For same-day examples, the result is 0 for elapsed time or 1 if counting the current day. Naming headers "Elapsed Days" or "Calendar Days (Inclusive)" helps share the meaning of the numbers with other team members.

Since this example calculates calendar day differences, requirements excluding weekends or holidays require a different calculation. For lists that permit blank start or end dates, check for completion before searching for negative values. Even if external data appears to be a date, string values require conversion to dates. According to Microsoft specifications, strings that cannot be interpreted as dates result in #VALUE!. Investigating the reversed sign issue and the uninterpretable date issue separately helps narrow down the required fixes.

Document information

Article title
Why Excel&apos;s DAYS Function Returns a Negative Date Difference: Detecting Reversed Start and End Dates
Published
Updated
Source
https://papanda925.com/?p=18831&lang=en

License: Text and original figures for which this site holds the relevant rights are available under CC BY 4.0 , unless otherwise noted. This article may include content created or edited with generative AI. If code has a separate license notice or a linked GitHub repository license, that license takes precedence for the code. Quotations, third-party materials, images, and trademarks are excluded from this license. Usage policy

Copied title and URL