In Excel: use =DATEVALUE(date_text) — it converts a date stored as text into a real date serial number, which is what makes sorting and filtering work again.
Syntax
Arguments
| Argument | Description | |
|---|---|---|
date_text | required | A date written as text, in a format your locale recognises. |
time_text | required | For TIMEVALUE: a time written as text. |
Related functions
Need it as an auditable file?
Ships inside the linked template — formula-driven, unlocked, audit-ready.
What this does
DATEVALUE turns text that reads like a date into an actual date value, and TIMEVALUE does the same for times. This is the repair for the most frequent import defect after text-stored numbers: dates that look right, sort alphabetically, and are ignored by every date filter and calculation. The catch is locale — "03/04/2026" is March in the US and April in Europe, and DATEVALUE follows your system settings without asking. Where the source format is unambiguous that is fine; where it is not, rebuilding the date with DATE and explicit parts is the safe route. Most people learn this as a sequence of clicks and forget it by next week; learning it as a pattern instead is what lets you apply it to the next, slightly different version of the problem without starting from scratch. That is the difference this page is trying to make. Treat “datevalue function in excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected formula shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a calculation you can defend to a CFO or an auditor into a method you can reuse, explain, and defend when the workbook leaves your screen.
A worked example
Repairing an imported text date: =DATEVALUE(A2), then format the result as a date. Confirming the problem first: =ISNUMBER(A2) returning FALSE on a date-looking cell means it is text. Locale-proof rebuilding for an unambiguous ISO string: =DATE(LEFT(A2,4), MID(A2,6,2), RIGHT(A2,2)). Combining a text date and time: =DATEVALUE(A2) + TIMEVALUE(B2). DATEVALUE fixes date columns that sort alphabetically, which is the defect that makes an imported report silently unusable. One habit worth forming early: name the cells that hold your inputs, so the formula reads in plain language instead of a string of cell addresses. A reviewer — or you in three months — can then follow the logic without decoding what B7 and D2 were supposed to mean, which is most of what makes a sheet maintainable.
In Google Sheets
If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top, the tool proves it, and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. If you take one thing from this page on “datevalue function in excel”, make it the habit rather than the keystrokes: set the problem up with labelled inputs, reference those cells, and let Excel do the recomputing. Bookmark the page for the syntax, but do the example once in a blank sheet and check it against the tool above — five minutes of hands-on practice fixes the method in memory far better than re-reading, and it surfaces the small snags while they are still harmless. After that the technique is genuinely yours: faster than searching for it again, and reliable enough to drop into work that other people depend on.
Common mistakes
- Trusting it on ambiguous formats such as 03/04/2026, where the locale silently decides the month.
- Passing a value that is already a real date, which returns
#VALUE!. - Forgetting to format the result, which shows a five-digit serial number.
Frequently asked questions
How do I convert text to a date in Excel?
=DATEVALUE(A2) then format as a date, or Data → Text to Columns with the date format selected for a whole column at once.
Why does DATEVALUE return #VALUE!?
Either the text is not recognisable as a date in your locale, or the cell already holds a real date.
How do I avoid the day/month ambiguity?
Rebuild the date explicitly with DATE and the parts sliced out of the string, which never depends on locale.
Other ways people ask this
This guide also answers
- datevalue formula in excel