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.
Using TEXT function in Excel to convert date to text
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:
Where:
value
is 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_text
this 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):
=TEXT(A1,"mm/dd/yyyy")
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.
Example 1. How to convert date to text strings in different formats
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.
Months:
- m - month number without a leading zero
- mm - month number with a leading zero
- mmm - short form of the month name, for example Mar
- mmmm - full form of the month name, for example March
- mmmmm - month as the first letter, for example M (stands for March and May)
Days:
- d - days number without a leading zero
- dd - day number with a leading zero
- ddd - abbreviated day of the week, for example Sun
- dddd - full name of the day of the week, for example Sunday
Years:
- yy - two-digit year
- yyyy - four-digit year
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:
- "mm/dd/yyyy" - the date format used in the USA, displays as 03/08/2015
- "dd/mm/yyyy" - the date format used by the rest of the world, displays as 08/03/2015
- "dd-mmm-yy" - displays as 08-Mar-15 to avoid any confusion : )
- "dddd, mmmm d, yyyy" - full date, including the day of the week, displays as Sunday, March 08, 2015
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:
=TEXT(A1,"mm/dd/yyyy")
Some more formula examples and their results are shown below:
Example 2. How to convert time to text strings
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.
Hours:
- h - hours without a leading zero, as 0-23.
- hh - hours with a leading zero, as 00-23.
Minutes:
- m - minutes without a leading zero, as 0-59
- mm - minutes with a leading zero, as 00-59
Seconds:
- s - seconds without a leading zero
- ss - seconds with a leading zero
Periods of the day:
- AM/PM - displays as AM or PM
- If not specified, 24-hour time format is used
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:
=TEXT(A2,"dd/mm/yyyy hh:mm")
If you want to convert the time portion only, then put only the time codes, like this:
=TEXT(A2,"h:mm AM/PM")
The results of your TEXT formulas may look similar to this:
Example 3. How to convert the current date to text in Excel
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:
=TEXT(TODAY(), "dd-mmm-yyyy")
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.
Example 4. Excel TEXT formula to convert text to date
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.
=--TEXT(A1,"mm/dd/yy")
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.
Converting date to text with Excel's Text to Columns wizard
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:
- In your Excel spreadsheet, select all of the dates you want to change to text.
- On the Data tab, find the Data Tools group, and click Text to Columns.
- On step 1 of the wizard, select the Delimited file type and click Next.
- On step 2 of the wizard, make sure none of the delimiter boxes is checked and click Next.
- On step 3 of the wizard, which is the final step, select Text under Column data format and click Finish.
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:
Convert Excel date to text via Notepad
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.
- In your Excel worksheet, format the dates exactly as you want the text strings to look like.
- Select all of the dates you want to convert and press Ctrl+C to copy them.
- Open Notepad or any other text editor, and paste the copied dates there.
- Notepad automatically converts the dates to the text format. Press Ctrl+A to select all text strings, and then Ctrl+C to copy them.
- Switch back to Microsoft Excel, select the column where you want to insert the text strings and apply the Text format to it. To do this, press Ctrl+1 to open the Format Cells dialog and select Text on the Number tab.
- Finally, select the first cell where you want to insert the text strings and press Ctrl+V to paste them.
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.
212 comments
Thank you so much!!!
Trying to convert date in format dd.mm.yyyy to text yyyymmdd but can't find any solution. Any advice?
Hi Tore!
I guess you didn't look for this solution in the article above. It covers your case completely.
=TEXT(A1,"yyyymmdd")
You can learn more about date formatting in this article: How to change Excel date format and create custom formatting.
In cell A1, I have the formula "=TEXT(TODAY(), "MMM-YY")", which yields JUL-24 (which is what I want). Now, how do I get cell B1 to yield the next consecutive month AUG-24? Thank you.
Hi! Try to use the recommendations described in this guide: How to add / subtract months to date in Excel. For example:
=TEXT(DATE(YEAR(TODAY()), MONTH(TODAY()) + 1, DAY(TODAY())), "MMM-YY")
I figured it out!
Cell A1: =TODAY()
Cell B1: =DATE(YEAR(A1),MONTH(A1)+1,1)
Cell C1: =DATE(YEAR(B1),MONTH(B1)+1,1)
Or, rather instead of typing out the formula for each consecutive month, just drag it out and the formula will autofill. Then, if you want to format the date a certain way, I used the customized date and changed it to MMM-YY or MMM-YYYY or however you wish for it to be displayed.
Results:
Cell A1 = Jul-2024
Cell B1 = Aug-2024
Cell C1 = Sep-2024
Okey so I have a date column with 2023-01-01 and I want in the next column just the month as text. When I use the formula I receive the value of 00. Any reasons why?
Hi! You can change the date format and show only the month name. Use the custom date format "mmmm". You can write the month name as text using TEXT function, as described above:
TEXT(A1,"mmmm")
THANK YOU! What an annoyance that was until I found this Notepad solution.
Hi. I need help with cleaning a date format. Is it possible that this kind of format (2023-07-01~2023-07-31) to a text? Basically, my data needs to be categorized monthly
Hi! Your sample date interval is text. To convert it to two dates, use these instructions: Split string by delimiter or pattern, separate text and numbers or TEXTSPLIT function in Excel: split text strings by delimiter. Then use the guidelines from the article above to convert the text to a date.
If I have a text string FEB80 and Excel reads it as 1 FEB 1980, using a formula function, how do I get to read it as FEB80. I have tried TEXT, TRIM & SUBSTITUTE Functions as well as using DATEVALUE & VALUE functions to force errors.
Hi! To prevent Excel from converting text to a date, add an apostrophe (') before the text.
Or set the cell to Text format before entering FEB80.
i want to convert in to dd-mmm-yyyy to this date 30th Jul 2023 11:59 PM but not able to do with formulas =TEXT(G2,"dd-mm-yyyy")
please help me
Hi! If I understand your question correctly, use these recommendations: How to change Excel date format and create custom formatting.
When we export the data to excel APR-2644 is showing as APR-44, could you please let me know the formatting so it show as APR-2644 only
Thank you
Based on your description, it is hard to completely understand your task. However, I’ll try to guess and offer you the following guide: How to change Excel date format and create custom formatting.
It worked for me. Thanks a lot
I have used the =TEXT(B2,"mmmm") i was expecting to have the result as January but instead I got 1/1/19 0:01 which is the same value in cell B2
What could be the problem?
Hello!
I could not repeat your problem. Perhaps the date in cell B2 is written as text.
Hello,
I have a spreadsheet in which I need to sort by month, then by supplier within each month and total both the month and the suppliers within the month. I have converted the month to 01,02 etc and sorted and subtotalled by the 01,02,03 etc. however because the original source material had the full date, it is not grouping all my same suppliers together within each month so I can subtotal them within the month, it is still using the background date code as the sorting source.
What am I missing?
Hello!
If I understand your task correctly, add an additional column and calculate the month in it using the MONTH function. By this column you can sort and calculate subtotals by month.
I need to change date to text, I typed =TEXT(B2,''mmmm''), but its giving an error. What have I typed wrongly
Hi!
It is possible that cell B2 is not a date. Possible custom date formats you can see here.
How to add time hours (exeed 24 hours) when hours are in text format ? →→=TEXT(1-[Start time]+[End time],"HH:MM")
Hi!
Please check out this article to learn how to add time: Calculate time in Excel: time difference, add, subtract and sum times. If this is not what you wanted, please describe the problem in more detail.
Hi team! I tried to convert US date to Spain date, the format in US is mm--dd-yyyy and in Spain is dd-mm-yyyy. I was using the =date() but it is not converting them. I also can't group those days in month or quarters, it saying this selection can't be grouped" something like that. The data is fine!
Hello!
You need to change the date format. Use this guide: How to change Excel date format and create custom formatting.
I have to convert the format 01-Feb to 1/2 and 01-oct to 1/10
Hi!
To change the date format, follow these instructions: How to change Excel date format and create custom formatting.
Try format d/m
i WANT TO CONVERT FROM 25-12-1995 TO TWENTYFIFTH DECEMBER NINTEEN NINETY FIVE
Hi!
Excel formulas cannot do this. You need to use VBA.
Can you help me how to convert 8/10/2022 to "For the month of Aug 2022" ? I would help me with my reporting instead of typing it manually. Thanks in advance.
Hi!
Have you tried the ways described in this blog post? Try this formula:
="For the month of "&TEXT(A1,"mmm yyyy")
Need to convert a date to a yy.mm format. I used to use =textjoin(",",,year(a2),month(a2)) but the formula does not seem to work with the latest version of Excel.. thoughts?
Hello!
You can set a custom date format in a cell. For example, "yyyy mm" or "yyyy,mm".
Also the TEXT function can help:
=TEXT(A2,"yyyy,mm")
Your formula also works for me in Excel365.
It worked, Thanks ))