Sub topic 15
Troubleshooting date problems
This chapter assumes you can enter formulas and use relative and absolute cell references. It also assumes you have used the Format menu to change number formats. It draws on the earlier chapters about serial numbers, display formats, text conversion, locale and time zone settings, and volatile functions. Here you will turn that knowledge into a repeatable way to find out why a date formula is wrong.
A diagnostic routine
Most date problems come from one of five causes: the cell holds text instead of a date, the format hides the real value, the locale parses text differently than you expect, the time zone shifts a time, or a volatile function recalculated. Check them in that order.
Step 1: Find out whether the cell is text
A real date is a number. Text that looks like a date is not, and date functions cannot use it. Two quick tests tell you which you have.
=ISNUMBER(A2)This returns TRUE for a real date and FALSE for text. A second sign is alignment. With default alignment, numbers sit on the right and text sits on the left. Dates that hug the left edge are often text.
=ISTEXT(A2)You can also change the cell's format to Number. A real date turns into a number such as 46354. Text stays unchanged.
Symptoms of text dates
=B2 - A2returns#VALUE!.=YEAR(A2)returns#VALUE!.- Sorting puts dates in alphabetical order, so "01/12/2026" sorts before "02/01/2025".
- A date column that is filled down gives the same value in every row instead of counting up.
Converting text to real dates
If the text is in an unambiguous ISO form (year-month-day), DATEVALUE is usually enough.
=DATEVALUE("2026-11-28")If the pieces are in a fixed layout, split them yourself and build the date with DATE. This does not depend on the locale.
=DATE(LEFT(A2, 4), MID(A2, 6, 2), RIGHT(A2, 2))This works when A2 contains text such as 2026-11-28. Sheets coerces the numeric text to numbers automatically. To handle a whole column, wrap the formula in ARRAYFORMULA and skip blank rows.
=ARRAYFORMULA(IF(A2:A="", "", DATE(LEFT(A2:A, 4), MID(A2:A, 6, 2), RIGHT(A2:A, 2))))Format the result column as a date, because the formula returns a serial number.
Hidden characters
Data pasted from web pages or exports often has a leading space or a non-breaking space. These make a date count as text even if it looks right. Remove ordinary spaces with TRIM. Non-breaking spaces need SUBSTITUTE, because TRIM does not remove them.
=DATEVALUE(TRIM(SUBSTITUTE(A2, CHAR(160), " ")))Step 2: Separate the value from its display
A format changes only how a number looks. Two situations cause confusion.
- A date shows as a number. The cell holds a valid serial number but has a Number or Automatic format. Apply Format > Number > Date.
- A number shows as a date. A formula result such as
=B2 - A2may be displayed as a date such as 1900-01-14 because Sheets copied the date format from the inputs. The value is a count of days. Change the format to Number.
Time values show a related problem. A duration of 30 hours displayed with a time format shows 06:00, because the format shows only the time-of-day part. Use a Duration format, or multiply by 24 to get hours as a plain number.
=(B2 - A2) * 24If a cell shows ########, the column is too narrow for the formatted value. Widen the column. The value is fine.
Step 3: Check the locale
The spreadsheet's locale decides how Sheets reads typed text. The same input can mean different dates.
| Typed text | United States locale | United Kingdom locale |
|---|---|---|
| 03/04/2026 | 4 March 2026 | 3 April 2026 |
| 13/04/2026 | Not a valid date, stays text | 13 April 2026 |
The second row shows why locale bugs can be hard to spot. Some rows in a column convert and others stay text, so the column looks mostly fine. Always check the rows where the first number is greater than 12.
The locale also affects the formula syntax. Some locales use a semicolon instead of a comma between arguments, and some change the function names shown in the editor. If a formula from a tutorial fails to parse, compare the separators first.
To make a formula independent of the locale, build the date from numbers.
=DATE(2026, 11, 28)To change the setting, open File > Settings and choose a locale. Changing the locale does not rewrite cells that already hold real dates. It only changes how new text is interpreted and how formats display.
Step 4: Check the time zone
The spreadsheet has its own time zone, set in File > Settings. NOW and TODAY use it. A time zone setting that differs from your own location explains a TODAY result that is a day ahead or behind in the early morning or late evening.
Imported timestamps from other systems are often in UTC. If the spreadsheet is set to a different zone, the date part can change near midnight. To shift a UTC timestamp to a known offset, add the offset as a fraction of a day.
=A2 + 5/24This adds five hours. Note that a fixed offset does not follow daylight saving changes. If your data crosses a change in clocks, the offset must change too.
Reading the current zone
Put =NOW() in a cell and compare it with a clock. If the time is off by whole hours, the spreadsheet's time zone is not the one you expected.
Step 5: Account for recalculation
NOW, TODAY, RAND and RANDBETWEEN are volatile. Sheets recalculates them when the sheet changes and on a time-based schedule. In File > Settings > Calculation you can set recalculation to on change, on change and every minute, or on change and every hour. TODAY updates when the day changes, but a sheet that nobody opens may not display the new value until it is opened.
This leads to two common problems.
- A "created on" stamp keeps changing.
=NOW()is not a timestamp. It shows the current time every time it recalculates. To keep a fixed time, enter it with the shortcut Ctrl+Shift+; (date and time) or Ctrl+; (date) on Windows. A script is needed for automatic stamps. - An age or due-date report changes when reopened. Anything that depends on TODAY changes each day. For a report that must not change, put the report date in a cell as a plain value and refer to that cell.
=DATEDIF(A2, $F$1, "Y")Here F1 holds the fixed report date. Replace it with TODAY() when you want a live age.
Step 6: Check the function's own rules
Some errors are caused by how the function works, not by the data.
DATEDIF
DATEDIF returns #NUM! if the start date is later than the end date. Swap the arguments or check the data. The unit must be text in quotes, such as "Y", "M" or "D".
=DATEDIF(A2, TODAY(), "Y")EDATE and EOMONTH
Both return a serial number, so format the result as a date. When the target month is shorter, EDATE gives the last valid day.
=EDATE(DATE(2026, 1, 31), 1)This returns 2026-02-28. It is not an error.
NETWORKDAYS and WORKDAY
NETWORKDAYS counts both the start day and the end day. A project from Monday to Friday counts 5 days, not 4. The holiday range must contain real dates. If a holiday list is text, the holidays are quietly ignored and the count is too high, with no error.
=NETWORKDAYS(A2, B2, Holidays!A2:A20)Test the holiday range with =COUNT(Holidays!A2:A20). The result should equal the number of holidays.
WEEKDAY
The default numbering starts on Sunday at 1. Pass type 2 for Monday as 1.
=WEEKDAY(A2, 2)Mixing the two numbering schemes in one workbook leads to weekend rules that are off by one day.
Quick reference: error messages
| Result | Likely cause | Fix |
|---|---|---|
| `#VALUE!` | An argument is text that is not a date | Convert with DATEVALUE or DATE |
| `#NUM!` | Start date is after end date, or the date is outside the allowed range | Check argument order and the data |
| `#NAME?` | Function name misspelled, or not recognised in this locale | Check spelling and locale |
| `#REF!` | A referenced cell or sheet was deleted | Repair the reference |
| Number such as 46354 | Cell has a Number format | Apply a date format |
| Date such as 1900-01-14 | Day count shown with a date format | Apply a Number format |
A worked example
A column of order dates was imported and =B2 - A2 returns #VALUE! for most rows.
=ISNUMBER(A2)returns FALSE, so the dates are text.- Some values are
28/11/2026, and the spreadsheet is in a United States locale. These cannot convert. - Each text value has the layout day/month/year, so split it with DATE.
=DATE(RIGHT(A2, 4), MID(A2, 4, 2), LEFT(A2, 2))- Format the new column as a date and use it in
=B2 - A2.
Exercise
A cell A2 shows 03/04/2026 left-aligned, and =YEAR(A2) returns #VALUE!. Name the first check you would run, and give a formula that builds a real date from this text if its layout is day/month/year.
Show answer
First run =ISNUMBER(A2). It returns FALSE, so the cell is text. Because the layout is day/month/year, build the date with =DATE(RIGHT(A2, 4), MID(A2, 4, 2), LEFT(A2, 2)). This returns 3 April 2026 regardless of the locale. Format the result as a date.
Exercise
A "date added" column uses =TODAY(), and last month's records now show today's date. Why does this happen, and how do you stop it?
Show answer
TODAY is volatile, so it recalculates and always returns the current date. To keep a fixed value, enter the date as a plain value, for example with Ctrl+; on Windows, or copy the cells and use Paste special > Values only.