To convert dates in Excel, first determine whether the cells contain real date serial numbers or text: format real dates with Home > Number Format, and convert text with Data > Text to Columns, Power Query, or a formula such as =DATEVALUE(A2) when Excel recognizes the text. For fixed patterns such as YYYYMMDD, assemble the year, month, and day with DATE so the result is a dependable Excel date value.
What Excel Means by a Date
Excel stores most dates as numbers, not as a special date-shaped value. The whole-number portion counts days from a starting point, while the decimal portion represents time within a day. A cell displaying March 15, 2024 might therefore hold the serial number 45366; a value with a fraction could represent a time on that date. Date formatting changes how the number looks, not the underlying value.
This distinction explains many conversion problems. A genuine date serial can be sorted chronologically, used in date arithmetic, or compared with another date. Text that merely looks like a date may sort alphabetically and may not work in calculations. Formatting text as a date does not necessarily turn it into a usable date; conversion is needed first.
Excel for Windows normally uses the 1900 date system. Some workbooks, often those created on older Mac systems, may use the 1904 system instead. The systems differ by 1,462 days, so dates can shift if a workbook is moved or its date-system setting is changed. When dates appear consistently offset after moving a workbook, check its date system rather than editing every cell.
Choose a Conversion Method
Start by inspecting a few cells and the formula bar. If changing the number format makes the value display as a date, the cell was probably already a numeric date. If the value remains unchanged, is left-aligned by default, or has a leading apostrophe, it may be text. These clues are useful but not conclusive: alignment can be customized, and imported data can contain mixed types.
- Real date serial displayed incorrectly: apply a date format; no conversion formula is needed.
- Consistent text dates Excel recognizes: try Text to Columns or a conversion formula.
- Fixed-width or compact text such as YYYYMMDD: build the date from its separate year, month, and day components.
- Large or recurring imports: use Power Query and assign a date type, including a locale when necessary.
- Unix timestamps or other numeric conventions: convert from the documented epoch or unit, not by applying an ordinary date format.
Before converting a full column, test a few typical entries, including the earliest and latest dates, blanks, and any unusual formats. Keep a copy of the original column until the converted values have been checked.
Format Values That Are Already Dates
If a cell contains a date serial, select the cells and choose Home > Number Format, then select a date style. For more control, press Ctrl+1 on Windows to open Format Cells, select the Number tab, and choose Date or Custom. A custom pattern such as yyyy-mm-dd displays an unambiguous year-month-day order; mmm d, yyyy displays a readable month name. On Mac, Command+1 opens Format Cells. Excel for the web offers number-format controls on the Home tab, though some detailed custom-format options can differ from desktop Excel.
To show a time as well, choose a date-and-time format or create a pattern such as yyyy-mm-dd hh:mm. A number format affects display only: it does not remove time from a value, change a date’s regional interpretation, or convert text. If a date serial appears as a large integer, applying a date format is usually the right fix. If a text entry still appears as text afterward, use a conversion method instead.
Convert Recognizable Date Text
For text that Excel can interpret using the computer’s regional settings, the DATEVALUE function returns a date serial. With text dates in A2:A20, put this formula in B2 and fill it down: =DATEVALUE(A2). If A2 contains the recognized text 2024-03-15, the result is the serial 45366, which displays as March 15, 2024 when B2 is formatted as a date. DATEVALUE returns the date component; it does not preserve a time included in the original text.
DATEVALUE depends on interpretation rules. A value such as 04/05/2024 can mean April 5 or May 4, depending on locale. If Excel does not recognize the text, it can return an error. Do not assume that changing a workbook’s display format resolves an ambiguous source. Confirm whether the source uses month-day-year or day-month-year before converting, especially for financial, reporting, or historical data.
For a column of consistently formatted entries, Text to Columns can convert in place. Select the text cells, choose Data > Text to Columns, select Delimited, and click Next twice. In the Column data format section, choose Date and the order used by the source, such as YMD or MDY, then click Finish. The wizard can be used even when the values are not separated by delimiters. Test a small copy first, because this operation replaces the selected contents. The desktop wizard is available in Excel for Windows; Excel for the web does not provide the same full Text to Columns workflow.
Handle Fixed Patterns Such as YYYYMMDD
When text is a fixed eight-digit year-month-day string, split its components explicitly instead of asking Excel to guess. With an eight-character YYYYMMDD value in A2, enter this in B2 and fill down: =DATE(VALUE(LEFT(A2,4)),VALUE(MID(A2,5,2)),VALUE(RIGHT(A2,2))). If A2 contains 20240315, the formula returns the date March 15, 2024, serial 45366. Format the result column as a date. This approach assumes every entry uses exactly four year digits followed by two month digits and two day digits.
The DATE function also normalizes out-of-range components rather than always rejecting them. For example, a month value beyond 12 can roll into the following year. That behavior can conceal malformed source data, so validate the input pattern and inspect the converted results instead of treating a successful formula as proof that every source entry was valid.
If separate numeric columns contain year, month, and day, combine them directly. With the year in A2, month in B2, and day in C2, enter =DATE(A2,B2,C2) in D2 and fill down. For 2024, 3, and 15, respectively, D2 is March 15, 2024. This is generally safer than joining the parts into a regional date string and asking Excel to parse it again.
Convert Imported Data with Power Query
Power Query is useful when dates arrive in a CSV file or must be refreshed regularly. In Excel for Microsoft 365 on Windows, use Data > From Text/CSV to connect to a file, inspect the preview, and select Transform Data when you need to adjust types before loading. In the Power Query Editor, select the date column and use Transform > Data Type. If the text’s date convention differs from the computer’s locale, choose Using Locale, then specify the appropriate data type and locale. Load the results back into Excel and verify representative dates.
Setting a type with locale is important for ambiguous strings: a day-month-year source should not silently be read as month-day-year. Power Query also makes repeat imports more consistent because the conversion steps are saved with the query. If the source file changes, refresh the query and check that its expected columns and date patterns remain intact. Menu labels and some import choices can vary slightly by Excel build, but the locale-aware type conversion is available in the Power Query Editor in current Microsoft 365 desktop Excel.
Convert Timestamps and Date-Time Values
A text timestamp may include both a date and a clock time. DATEVALUE alone discards the time portion, so use a date-and-time conversion when both matter. With text such as 2024-03-15 14:30:00 in A2, enter =DATEVALUE(LEFT(A2,10))+TIMEVALUE(MID(A2,12,8)) in B2. It returns March 15, 2024 at 2:30 PM when the date and time portions are recognized by Excel. Format B2 to show both date and time. This example assumes the text has exactly the stated layout, with a space between date and time.
Unix timestamps count time from January 1, 1970, and are not Excel serial dates. With a Unix timestamp in seconds in A2, enter =DATE(1970,1,1)+A2/86400 in B2. For 1710504000, the result is March 15, 2024 at 12:00 UTC, because there are 86,400 seconds in a day. Format the result to display date and time. This calculation does not apply a time-zone conversion; timestamps recorded in UTC will still represent UTC unless you separately adjust them for the desired zone. If the source timestamp is in milliseconds, divide by 86,400,000 instead of 86,400.
Common Errors and Checks
A date formula can return an error or a plausible but wrong result for several reasons. Regional interpretation, extra spaces, hidden characters, inconsistent separators, and mixed date conventions are common causes. If some entries convert and others do not, inspect the failed rows for leading or trailing spaces and different source patterns. TRIM can remove ordinary extra spaces, but it does not remove every nonprinting character or solve ambiguous date order.
- Numbers appear as five-digit values: apply a date format if they are valid date serials.
- Text refuses to change appearance: convert the text; number formatting alone cannot make it numeric.
- Dates sort in an unexpected order: check for a mixture of text and real dates, then sort only after standardizing the column.
- Dates shift after a workbook move: check the 1900 versus 1904 date-system setting.
- Times disappear: use a date-time conversion and a format that includes hours and minutes.
- One day appears off: confirm the source’s time zone, date order, and whether a timestamp crosses midnight after conversion.
For quality checks, compare a sample against the original source, look for errors, and ensure the results fall within the expected date range. A converted column can be copied and pasted as values after validation if you need to remove formulas, but retain the original data until the workbook’s downstream calculations have been checked.
Frequently Asked Questions
Does changing the Excel date format convert text into a date?
No. A number format changes the display of numeric values. Text must first be converted, for example with Text to Columns, Power Query, or a suitable formula.
Why does Excel show a date as a number?
Excel stores dates as serial numbers. Select the cell and apply a date format to display a calendar date, provided the number is a valid date serial and not a different kind of value.
How do I convert YYYYMMDD to a real date in Excel?
For a consistent eight-digit string in A2, use =DATE(VALUE(LEFT(A2,4)),VALUE(MID(A2,5,2)),VALUE(RIGHT(A2,2))). Format the result as a date and confirm the source uses year, month, then day.
How can I stop Excel from swapping day and month?
Use Text to Columns and explicitly select the source date order, or use Power Query’s Using Locale option. Do not rely on automatic interpretation for ambiguous values such as 04/05/2024.
Can Excel convert a date stored as text without a formula?
Often, yes. Text to Columns can assign a date order and convert a selected range. For recurring imports, Power Query is a better repeatable option; whichever method you use, verify the result before replacing the source.
Related
- Excel Not Clicking the Correct Cell? Causes and Fixes
- Excel Copy and Paste Rows Into Columns: 3 Easy Methods
- Excel Not Responding: Should You Wait or Close It?
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Very Slow Saving Files? Causes and FixesIf Excel is very slow saving files, first save a copy to a local folder and compare the…
- Roundup Excel Without Decimals: 10 Reliable MethodsTo round a value in Excel to the nearest whole number, use =ROUND(A2,0); to make every positive value…
- Excel SUM Divided by Count: Calculate an AverageTo add a range in Excel and divide by the number of numeric cells, use =SUM(B2:B6)/COUNT(B2:B6) when the…
- Excel Day Counter: Count Days Between DatesWith a start date in A2 and an end date in B2, enter =B2-A2 to count the days…
- Find Excel Spreadsheet Not Saved? Recovery Steps That WorkIf you closed an Excel workbook without saving, open Excel and select File > Info > Manage Workbook…
- Excel Replace Shortcut: Use Ctrl+H and Find & ReplaceIn Excel for Microsoft 365 on Windows, press Ctrl+H to open Find and Replace on the Replace tab.…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.