← All how-to recipes

How to convert text to a real date

✓ Verified in LibreOffice 25.8.7.3

Turn a date stored as text (like an import or CSV column) into a real date you can sort and calculate with.

The formula

AppFormulaNotes
Excel=DATEVALUE(A2)Format the result cell as a date. Works when the text matches a recognized date format.
Google Sheets=DATEVALUE(A2)Identical.
LibreOffice Calc=DATEVALUE(A2)Identical.

How it works

DATEVALUE parses a text date into the date serial number spreadsheets use internally — "2026-07-21" becomes 46224 (days since the epoch). Format the cell as a date to display it normally; sorting and date arithmetic now work. ISO format (yyyy-mm-dd) parses reliably in all three apps; ambiguous formats like 07/03/2026 follow the spreadsheet's locale, which is the usual source of imported-date bugs.

Verified, not just documented

We ran =DATEVALUE(A2) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 46224 — exactly the expected result. Every formula here is confirmed by actually executing it.