Formula Errors

Fix Excel DATEDIF #VALUE! Errors Caused by Text Dates

Amos GikundaAmos Gikunda Dec 2, 2026 869 views

Question details

Convert text dates into valid spreadsheet dates so DATEDIF can calculate the difference between them.

Fix Excel DATEDIF #VALUE! Errors Caused by Text Dates
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet uses DATEDIF to calculate the number of days between two dates.
Observed behavior
DATEDIF returns #VALUE! when a referenced date is stored as text or cannot be interpreted using the expected regional date order.
Before you start

Identify the cells containing the start and end dates and confirm the intended date order in the source data. In an empty cell, use =ISNUMBER(A2) to check whether A2 is already stored as a numeric date.

Solution 1Recommended

Convert text dates with Excel Text to Columns

Use this method to convert a column of text dates when you know whether the source uses month-day-year or day-month-year order.

1
Select the date column

Select the cells containing the text dates, then choose Data > Text to Columns.

2
Open the date format options

In the wizard, choose Delimited and click Next twice to reach the Column data format options.

3
Choose the source date order

Select Date and choose MDY for month-day-year text or DMY for day-month-year text. Click Finish, then repeat for the other date column if needed.

4
Check the dates and formula

Confirm the converted dates represent the intended days. Then enter =DATEDIF(A2,B2,"d"), where A2 is the start date and B2 is the end date.

Convert text dates with Excel Text to Columns
Check ambiguous dates: A value such as 03/04/2022 could mean March 4 or April 3. Choose the order used by the source data; changing a cell's display format alone does not convert text into a date.
Calculate dates in WPS Spreadsheet

Convert text dates and use DATEDIF in WPS Spreadsheet

Open your workbook in WPS Spreadsheet, convert recognized text dates with DATEVALUE, and calculate the difference with DATEDIF.

  1. 1. Open the workbook: Open WPS Spreadsheet and select Open to choose your Excel workbook.
  2. 2. Convert both dates: If A2 and B2 contain recognized text dates, enter =DATEVALUE(A2) in C2 and =DATEVALUE(B2) in D2.
  3. 3. Verify the results: Select C2 and D2 and apply a date format using the Home tab's number-format controls. Check that both dates match the source data.
  4. 4. Calculate the days: In an empty cell, enter =DATEDIF(C2,D2,"d"). If DATEVALUE does not recognize the text, check the source date order and regional settings.
Convert recognized text dates before calculating date differencesOpen and edit Microsoft Excel XLSX and XLS filesWork with familiar spreadsheet formulas and controlsUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

How can I tell if a date is stored as text?

Enter =ISNUMBER(A2) in an empty cell. TRUE indicates A2 contains a number, as Excel dates normally do; FALSE indicates it is not a numeric date.

Why does changing the cell format not fix DATEDIF?

A date format changes how a numeric date appears; it does not necessarily convert text into a date. Use Data > Text to Columns or DATEVALUE to convert the value.

Which date order should I choose for 3/30/2022?

Choose MDY if the source means March 30, 2022. The value cannot be a valid DMY date because there is no 30th month.

What happens if the start date is after the end date?

DATEDIF returns #NUM! when the start date is later than the end date. Check the referenced cells and their order in =DATEDIF(start_date,end_date,"d").

Why can DATEVALUE return #VALUE! for a date that looks valid?

The text may not match a date format recognized by Excel's regional settings. Check the source format and use Data > Text to Columns with the appropriate MDY or DMY order.