Sub topic 8
Converting Between Text and Dates
This chapter assumes you can enter formulas, use relative and absolute cell references, and apply number formats from the Format menu. The key distinction is that a date value is a number that Google Sheets can calculate with, while date-looking text is only a string of characters.
Recognizing dates and date-looking text
A cell containing a real date can be used with functions such as YEAR, MONTH, or subtraction. A cell containing text may look identical but fail in calculations.
For example, 2026-11-28 can be either a real date or text. Select the cell and check its alignment, number format, and behavior in a formula. You can also test it with:
=ISNUMBER(A2)TRUE means Sheets stores the value as a number. FALSE usually means the value is text.
Sheets stores a date as a serial number and a time as a fraction of a day. A number format displays that value as a date or time. Converting text to a date creates a usable serial-number value.
Converting text into date values
DATEVALUE converts text that Sheets recognizes as a date. The result is a number displayed according to the cell's format.
=DATEVALUE("2026-11-28")You can also reference a cell:
=DATEVALUE(A2)This conversion can depend on the spreadsheet's locale. For example, 03/04/2026 may mean March 4 or April 3. A locale-independent approach is to split a predictable string and rebuild it with DATE.
For text in the format yyyy-mm-dd, use:
=DATE(VALUE(LEFT(A2, 4)), VALUE(MID(A2, 6, 2)), VALUE(RIGHT(A2, 2)))LEFT, MID, and RIGHT extract pieces of the text. VALUE converts each extracted piece into a number. DATE then builds a real date from the year, month, and day.
> callout note > Prefer DATE when the source components are known. Use DATEVALUE when the text format is consistent and already matches the spreadsheet's locale.
Converting text into times
TIMEVALUE converts a time string into a fraction of a day.
=TIMEVALUE("14:30:00")If A2 contains 14:30, this formula returns a time value:
=TIMEVALUE(A2)Format the result as a time with Format > Number > Time. To combine separate date and time text, add the two converted values:
=DATEVALUE(A2) + TIMEVALUE(B2)The result is one date-time value that you can subtract from another date-time value.
Formatting dates as text
TEXT converts a date value into a text label. It does not return a value suitable for date arithmetic.
=TEXT(A2, "yyyy-mm-dd")Use this for labels, filenames, or messages. Keep the original date in another cell when you still need sorting, filtering, or calculations.
| Purpose | Formula | Result type |
|---|---|---|
| Convert date text | `=DATEVALUE(A2)` | Date value |
| Convert time text | `=TIMEVALUE(A2)` | Time value |
| Create a label | `=TEXT(A2, "mmm d, yyyy")` | Text |
Exercise
A2 contains the text 2026-11-28, and B2 contains 09:15. Write a formula that creates one usable date-time value and explain why TEXT should not be used for this step.
Show answer
Use =DATEVALUE(A2)+TIMEVALUE(B2). Both functions return numeric date or time values, so Sheets can calculate with the result. TEXT would return text instead.