Spreadsheet Practice

How to fix #VALUE! when subtracting dates in Excel

Formula (Excel and Google Sheets)

=C2-DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2))

The dates are text in day/month/year order. Rebuild them with DATE: =C2-DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2)).

Result on the example
one result per row in D2, filled down to D6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in D2, filled down to D6. Change any input and the result updates, or edit the formula to experiment.

How it works

The booking dates came from a system that writes day/month/year, and they are stored as text. A workbook set to US dates can't read "15/09/2026" (there is no month 15), so the subtraction returns #VALUE!. Worse, "03/09/2026" is read as March 9 and gives a wrong answer with no error. DATE builds the real date from the year, month and day pieces, whatever the computer's settings.

=C2-DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2))

Result17

  1. C210/2/2026

    The value in C2.

  2. B2"15/09/2026"

    The value in B2.

  3. RIGHT(B2,4)"2026"

    RIGHT: Characters from the end of text.

    • textB2"15/09/2026"
    • num_chars4
  4. MID(B2,4,2)"09"

    MID: Characters from the middle of text.

    • textB2"15/09/2026"
    • start_num4
    • num_chars2
  5. LEFT(B2,2)"15"

    LEFT: Characters from the start of text.

    • textB2"15/09/2026"
    • num_chars2
  6. DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2))9/15/2026 (46280)

    DATE: Builds a date from parts.

    • yearRIGHT(B2,4)"2026"
    • monthMID(B2,4,2)"09"
    • dayLEFT(B2,2)"15"
  7. C2-DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2))17

    The - operator subtracts.

In Google Sheets

The same formula works in Google Sheets: =C2-DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2)). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=C2-DATEVALUE(MID(B2,4,2)&"/"&LEFT(B2,2)&"/"&RIGHT(B2,4))17, 17, 48…Rearranges the text into month/day/year for DATEVALUE. This one depends on the computer's date settings.
=DAYS(C2,DATE(RIGHT(B2,4),MID(B2,4,2),LEFT(B2,2)))17, 17, 48…DAYS(end, start) gives the same count and reads clearly.

Common mistakes

  • Day/month text with a day of 12 or less converts silently to the wrong date. Fix the whole column, not just the rows that error.
  • For a permanent fix, select the column and use Data, Text to Columns, with the column type Date: DMY.
  • Check with =ISTEXT(B2): real dates are numbers, not text.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Fix #VALUE! when subtracting dates

In D2, calculate the days between the booking date (text in day/month/year order) and the arrival date. Fill down to D6.

Questions

What if the dates use dots, like 15.09.2026?

The characters sit in the same positions, so the same formula works.

What if the dates include a time?

The difference includes a fraction of a day. Wrap it in INT for whole days.

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.