In the previous article, we discussed different ways to convert text to date in Excel. If you are looking for a solution to the opposite task - changing an Excel date to text - a few choices are available to you again.
Traditionally, we'll begin with a formula solution and then explore a couple of non-formula ways.
The Excel TEXT function is specially designed to convert a numeric value to a text string and display it in the format you specify.
The syntax of the Excel TEXT function is as follows:
valueis a numeric value you want to convert to text. This can be a number, a formula that returns a numeric value, or a reference to a cell containing a number.
format_textthis is how you want to format the resulting text value, provided as a text string enclosed in quotation marks.
For example, you can use the following formula to convert a date in cell A1 to a text string in the traditional US date format (month/day/year):
As you see in the screenshot above, the value returned by the TEXT formula is aligned to the left, which is the first sign that points to a date formatted as text. Apart from alignment in a cell, there are a few more indicators that can help you distinguish between dates and text strings in Excel.
Since Excel dates are serial numbers in their nature, the Excel TEXT function has no problem with converting them to text values. The most challenging part is probably specifying the proper display formatting for the text dates.
Microsoft Excel understands the following date codes.
To display the converted text date exactly the way you want, you can separate the date codes with various delimiters such as dash (-), slash (/), comma (,) colon (:), etc. Here are a few examples:
For example, if you have a column of US dates in Excel and you need to export them to a .csv file for your UK based partner, you can convert the dates to the UK format, as a courtesy:
Some more formula examples and their results are shown below:
If your date entries display both dates and times and you want to change them to text strings exactly as they are, you included the following time codes in the format_text argument of the Excel TEXT function.
Periods of the day:
As you probably noticed, the m codes are used for months as well as minutes, and you might be curious how Microsoft Excel distinguishes between them. If you put "m" immediately after h codes (hours) or immediately before s codes (seconds), Excel understands you want to display minutes rather than a month. Yep, it's that simple : )
The TEXT function in Excel allows including both date and time codes in the
format_text argument, for example:
If you want to convert the time portion only, then put only the time codes, like this:
The results of your TEXT formulas may look similar to this:
In case you want to convert the current date to the text format, you can use the Excel TEXT function in combination with the TODAY function that returns the current date, for example:
The result of this formula would show up as 08-Mar-2015. If you prefer to display the resulting text string in some other format, please see the date codes discussed in Example 1.
Though the main destination of the TEXT function in Excel is converting numbers to text, it can also perform a reverse conversion, i.e. change text to date. For this, you simply add the double negation (--) to your TEXT formula.
For example, to convert a text string in cell A1 to date, you use the below formula, and then format the cell as a date.
Note. In the above examples, we used the date and time codes for the English locale of Excel. If you have a different locale, the codes may be different for your language.
As you've just seen, Excel's TEXT function makes a good job of converting dates to text. But if you are not a big fan of Excel formulas, you might like this solution better.
If you had a chance to read the previous part of our Excel dates tutorial, you already know how to use Text to Columns to change text to date. To convert dates to text strings, you proceed in the same way with the only difference that you choose Text instead of Date on the final step of the wizard.
Note. The Text to Column wizard always converts dates in the default short date format regardless of how the original dates are displayed in your worksheet. You can find more about default date and time formats in the following article: Default date format in Excel.
If the default date format is not what you are looking for, you can jump right to the next solution that lets you convert dates to text strings in any format of your choosing.
If you don't mind the default format, then perform the following steps:
Tip. If you don't want the resulting text strings to overwrite the original dates, specify the Destination for the top cell of the new column.
That was really easy, right? The screenshot below demonstrates the result - dates converted to text strings in the default short date format set in your Windows Regional settings, which is "mm/dd/yyyy" in my case:
Another quick no-formula way to turn Excel dates into text strings is using Notepad or any other text editor. Unlike the Text to Columns wizard, it allows you to convert Excel date to text in any format of your choosing.
The following screenshot shows the result, with the original Excel dates in column B and text entries in column D. Please notice that the converted text strings reflect the original date format with absolute accuracy, except they are left-alighted, as all text values are supposed to be in Excel.
This is how you convert date to text in Excel. Next week we will explorer a few Excel functions to work with weekdays and days of the year. And in the meantime, you may want to check out the previous parts of our comprehensive tutorial to working with dates and times in Excel.
Table of contents