How to Convert Text to Date in Google Sheets (3 Easy Ways)

In this tutorial, we will look at how to convert a text to date in Google Sheets. The importance of this transformation cannot be understated as many crucial calculations occur in spreadsheets around dates.

The Importance of Converting a Text to a Date

The date is a numerical value that is notorious for being the type of data that gives the most errors in calculations to users in a spreadsheet. So, it is crucial to get things right.

This commonly happens when some dates are presented as text rather than numerical values. You can’t calculate with text values of course, for example, sorting a dataset chronologically.

Situations where a Date might be Interpreted as Text

There are three such instances where a date might be a text string unbeknownst to its user:

  1. The dates are inserted in a different format. Google Sheets has its own localized format for recognizing dates. By default, it depends on the region you are in. If one user entered the date in their local format, chances are that that date will not be recognized in your region and thus be saved as text.
  2. The date might have been saved as text. More often than not, for security or formatting reasons, users can save their dates as text. This can also be done by simply putting an apostrophe (‘) in front of the date.
  3. The date could have been saved in an 8-digit format, “yyyymmdd”. This is commonly seen when extracting data from documents like PDFs.

In this article, we will show you how to resolve each of these issues in three separate approaches.

3 Ways to Convert Text to Date in Google Sheets

Check First! Determine if the Value is a Date or Not

It is always a good idea to check whether the dates you are working with are the correct time. We want numbers to be numbers, strings to be text, and dates to have a date value.

For dates, the text is quite simple. You only need to apply the ISDATE function on the cells containing dates. However, this function only checks the format of how the data is presented, not the underlying value type. So, even if a text has the correct date format, this function will return TRUE.

Thus, the best approach is to use the ISTEXT function if you suspect the dates are in the text format.

=ISTEXT(B2)

finding text with istext function - convert text to date in google sheets

1. Change Location Settings to Convert Text to Date in Google Sheets

The first use that we mentioned is the mismatch of date format of different regions of the world. With Google Sheets tracking location data, it will only recognize the formats suited to your region.

So, if you import or work with a spreadsheet created in another region, the date format may not be recognized and seen as a text string.

improper format gives to the wrong results

Our default format is “MM/DD/YYYY”, but the date we have imported is in “DD/MM/YYYY” format. Thus, it is seen as text or gives the wrong date.

To remedy this issue, we must change the locale settings to match that of the given date.

Step 1: Navigate to Settings from the File tab. File > Settings

navigating to settings from the file tab

Step 2: In the Settings window, under the General tab, you will find Locale. By default, it is set to the United States, meaning the date format is MM/DD/YYYY.

general and locale settings of google sheets

We must change the Locale to the United Kingdom, or any other region that accepts the DD/MM/YYYY format.

updating the locale to the united kingdom

Step 3: Click Save and reload to reload the worksheet with the updated settings.

finalized locale setting to convert text to date in google sheets

Now, any date that is inserted or imported in the DD/MM/YYYY format will be correctly shown as a date.

google sheets accepting the dd/mm/yyyy format animated

Read More: How to Format Date in Google Sheets (3 Easy Ways)

2. Using DATEVALUE and TO_DATE Functions to Convert Text to Date

The second issue, and the primary objective of our article, we had was what to do when faced with dates that are saved as text. This is represented by the following image:

all dates in the date column are text strings

At first glance, the dates may look correct but when we go to use them in any numerical calculation, we will not get the correct results.

To remedy this, we use a combination of two functions: DATEVALUE and TO_DATE.

Even if our dates are presented as text (as seen by the ISTEXT check) the values themselves follow the correct date format. Meaning that they will be considered as dates even if you can’t use them in calculations. We can utilize the DATEVALUE function to extract the value of the date.

=DATEVALUE(B3)

extracting the value of the date from the text string using the datevalue function

Even though we have successfully converted the string date to a numerical date, we still have to present the value in the correct format. That’s where the TO_DATE function comes in.

What the function does is it converts a number to a date.

Our formula to convert the text value to a date in Google Sheets:

=TO_DATE(DATEVALUE(B3))

how to convert text to date in google sheets using to_date and datevalue functions

Problem: Datevalue parameter cannot be parsed to date/time

This is a common issue faced by many users when trying to find the value of a date with date formats that don’t match the locale.

converting text to date value error in google sheets

Solution: Change the Locale settings from the Settings window (see method 1 of the article). It should not only give the correct value from the DATEVALUE function but also work with the intended date format.

Read More: How to Format Date with Formula in Google Sheets (3 Easy Ways)

3. Convert the 8-digit Number to Date in Google Sheets

For security purposes, most documents are usually saved as PDFs. These PDFs contain datasets that are usually imported to spreadsheets for use.

During import, date fields may be transformed into the following format:

the 8-digit date format extracted from a pdf

This 8-digit value is none other than the date in the “YYYYMMDD” format.

To transform this numerical value into a proper date, we first have to split the values of the year, month, and day. Then apply them in the DATE function.

To get the Year:

LEFT(B3,4)

using the left function to extract the year value from the 8-digit date code

For Month:

MID(B3,5,2)

using the mid function to extract the month value from the 8-digit date code

For Day:

RIGHT(B3,2)

using the right function to extract the day value from the 8-digit date code

Now, combining all these functions inside the DATE function:

=DATE(LEFT(B3,4),MID(B3,5,2),RIGHT(B3,2))

how to convert 8-digit date code to a proper date in google sheets using the date function

Note that the values in the Year, Month, and Day columns are in string form. With the help of the DATE function, we were able to convert those text values to a proper date in Google Sheets.

Read More: Generate Automatic Date in Google Sheets (3 Easy Ways)

Final Words

That concludes our guide to converting text to date in Google Sheets. The crux of the conversion lies in the formatting of the dates, which can be set from the settings or updated through formulas.

Feel free to leave any queries or advice you might have for us in the comments section below.


Related Articles

Mehrab Imtiaz

Mehrab Imtiaz

Mehrab Imtiaz is a Technical Writer for officewheel.com specializing in everything Google Sheets. Mehrab has always had a profound passion for writing and with his experience with MS Excel and Google Sheets throughout his career, it seems to be a great match when it comes to dishing out tips and tutorials for all to enjoy.

We will be happy to hear your thoughts

Leave a reply

OfficeWheel
Logo