New Tool Radar

AI for Data & Spreadsheets

How to Check an AI-Written Date-Difference Formula for a Hidden Time Component

Check an AI-written date-difference formula for a time of day that skews the day count by one.

Schematic with three steps: Show the full value of each date; Compare the formula result with a calendar; Strip the time with INT and re-check.

Excel stores dates as whole days and times as fractions of a day, so a date that looks like 5 March may really be 5 March at 14:30. Subtracting two such values gives a result with a fractional part, and rounding it the wrong way turns a 10-day gap into 9 or 11 days. Before trusting an AI-written day count, check whether either date carries a time.

What you need

  • The AI-written date-difference formula
  • The two dates it subtracts, with their full values visible
  • The day count you expect from a calendar

Step 1: Show the full value of each date

Change the format of both date cells to General and look at the numbers: a whole number is a pure date, while a decimal fraction means a time of day is hiding in the value. Note the fraction on each date.

Step 2: Compare the formula result with a calendar count

Count the days between the two dates on a calendar and compare with the formula result. A result that is a fraction, or one day out, points at the hidden time.

Step 3: Strip the time with INT and re-check

Wrap each date in INT to drop the time part, then subtract again and compare with the calendar count. If the result now matches, the time component was the cause.

Worked example: synthetic booking from 1 March to 11 March

The table below is a synthetic example. It shows the expected result of checking a date-difference formula; no formula was run.

Check Value Result
Calendar day count 10 1 March to 11 March
Start date full value 45716.60 1 March at 14:24
End date full value 45726.00 11 March at 00:00
AI formula result 9.40 Fraction from the time
Corrected result with INT 10 Matches the calendar

Expected result (UNTESTED). the AI formula returns 9.40 instead of 10 days because the start date carries a time of 14:24; stripping the time with INT gives exactly 10 days. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • INT strips the time but also changes a date that is really a timestamp; keep the original values untouched in a copy.
  • A date stored as text subtracts as an error, not a number; convert it to a real date first.
  • Day counts depend on whether both endpoints are included; agree that before checking.
  • Different date systems (1900 vs 1904) shift every date by 1,462 days, which dwarfs a one-day time error.

Sources

See all