# DATEVALUE formula generator

> Describe what you need and get a DATEVALUE formula for Excel and Google Sheets, run on real data before you copy it. Plus 8 tested DATEVALUE examples.

Source: https://spreadsheetpractice.com/tools/formula-generator/datevalue · Updated October 29, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

DATEVALUE converts a date that is stored as text into a real date that Excel can sort, subtract and format.

Describe the task at [DATEVALUE formula generator](https://spreadsheetpractice.com/tools/formula-generator/datevalue) and get a DATEVALUE formula for Excel and Google Sheets, tested on real data.

## Tested DATEVALUE examples

### Fix dates stored as text

`=DATEVALUE(A2)`

Excel. Result on the sample sheet: 6 rows (B2:B7). [See it and try it](https://spreadsheetpractice.com/formulas/fix-dates-stored-as-text)

### Convert text to a date

`=DATEVALUE(A2)`

Excel. Result on the sample sheet: 6 rows (B2:B7). [See it and try it](https://spreadsheetpractice.com/formulas/convert-text-to-a-date)

### Convert a month name to a number

`=MONTH(DATEVALUE(A2&" 1"))`

Excel. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/convert-a-month-name-to-a-number)

### Look up a date when dates are stored as text

`=XLOOKUP(DATEVALUE(E1),A2:A8,B2:B8)`

Excel. Result on the sample sheet: $4,560. [See it and try it](https://spreadsheetpractice.com/formulas/lookup-dates-stored-as-text)

### Extract a date from text

`=DATEVALUE(REGEXEXTRACT(A2,"\d{1,2}/\d{1,2}/\d{4}"))`

Google Sheets. Result on the sample sheet: 5 rows (B2:B6). [See it and try it](https://spreadsheetpractice.com/formulas/extract-a-date-from-text-in-google-sheets)

### Why does MAX return 0 for a column of dates

`=MAX(DATEVALUE(B2:B7))`

Excel. Result on the sample sheet: 4/27/2026. [See it and try it](https://spreadsheetpractice.com/formulas/max-of-dates-returns-zero)

### Why are my dates not sorting correctly

`=SORTBY(A2:C8,DATEVALUE(A2:A8))`

Excel. Result on the sample sheet: 7 rows (E2:G8). [See it and try it](https://spreadsheetpractice.com/formulas/dates-not-sorting-correctly)

### Fix DATEVALUE returning #VALUE!

`=IF(ISNUMBER(A2),A2,DATEVALUE(TRIM(A2)))`

Excel. Result on the sample sheet: 6 rows (B2:B7). [See it and try it](https://spreadsheetpractice.com/formulas/fix-datevalue-value-error)

## Questions

### What does the DATEVALUE formula generator do?

You describe the task in plain English, and it writes the formula, using DATEVALUE where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.

### What does DATEVALUE do?

DATEVALUE converts a date that is stored as text into a real date that Excel can sort, subtract and format.

### Can I learn to write DATEVALUE formulas myself?

Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the DATEVALUE function page has a practice exercise.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
