Fix Excel TEXT Function Formatting for Date Strings
Question details
The user wants to format a date as yyyymmdd with Excel's TEXT function.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A formula passes a quoted date string to TEXT, or the source date is stored as text.
- Observed behavior
- TEXT returns the original date string instead of the expected yyyymmdd result.
Check whether the source cell contains a real Excel date or a text string. Identify the intended day and month before converting an ambiguous date such as 2/11/2022.
Use a real date value with the TEXT function
Use this method when you know the date components or the source cell already contains a real Excel date.
In an empty cell, enter =TEXT(DATE(2022,11,2),"yyyymmdd") and press Enter. The result is 20221102.
If A1 contains a real Excel date, enter =TEXT(A1,"yyyymmdd") in another cell. Do not put quotation marks around A1.
If the formula still does not produce the expected result, select the source cell and check whether it contains a text date. Convert the text to a real date before applying TEXT.

Convert a text date with Excel Text to Columns
Use this method when dates are stored as text and their day, month, and year order is known.
Format a date as yyyymmdd in WPS Spreadsheet
Use DATE and TEXT in WPS Spreadsheet to construct an unambiguous date and return it in yyyymmdd format.
- 1. Open a spreadsheet: Open WPS Spreadsheet and create a blank workbook or open an existing Excel file.
- 2. Enter the formula: Select an empty cell and enter =TEXT(DATE(2022,11,2),"yyyymmdd").
- 3. Check the result: Press Enter and confirm that the cell displays 20221102.
- 4. Use a date cell instead: If A1 contains a real date, enter =TEXT(A1,"yyyymmdd") in an empty cell to format that value.

Frequently Asked Questions
Why doesn't TEXT format my quoted date correctly?
A quoted date is text, and its interpretation can depend on regional settings. Use DATE to construct the value explicitly, such as =TEXT(DATE(2022,11,2),"yyyymmdd").
Should I put quotation marks around a cell reference?
No. Use =TEXT(A1,"yyyymmdd"), not =TEXT("A1","yyyymmdd"). Quotation marks make A1 literal text rather than a cell reference.
How can I convert dates stored as text in Excel?
Select the cells and choose Data > Text to Columns. At the column data format step, select Date and the order that matches the source text, then click Finish.
Can I calculate with the result of TEXT?
TEXT returns a text string. Use the original date value for date calculations and the TEXT result for display or export.




