In Excel: for an eight-digit YYYYMMDD value in A2, enter =DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)) in a separate cell, then format the result as mm/dd/yyyy. 20260901 becomes September 1, 2026. Check invalid inputs before replacing the source.
On this page8
Confirm the input is an eight-digit YYYYMMDD code, such as numeric 20260901 or text "20260901". Keep the source in A2; do not split a cell that already holds a date serial.
In B2 enter =DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)). This creates a new numeric date; it does not alter A2.
Format B2 using Format Cells > Custom > mm/dd/yyyy. On Windows open Format Cells with Ctrl+1; on Mac use Command+1.
For imported rows, use the checked B/C formulas below. Require eight characters and an exact YYYYMMDD round trip; review every invalid-input message.
Fill the formulas down only through your input rows. Compare September 1 and the valid leap-day example with the expected results before continuing.
If you need fixed dates, copy validated dates and use Paste Special > Values in a new column. If you need export text, use TEXT on valid dates instead and keep the numeric dates for calculations.
Convert 20260901 and reject impossible dates
Paste the original inputs into A1 on a spare sheet. Keep A intact. B holds a candidate date; C holds only a checked date or an explicit invalid-input message. Format valid B:C results as mm/dd/yyyy.
A1| Cell | Formula | Purpose |
|---|---|---|
| B2 | =IFERROR(DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)),"") | Build a candidate; leave formula errors blank |
| C2 | =IFERROR(IF(AND(LEN(A2&"")=8,VALUE(LEFT(A2,4))>=1901,TEXT(B2,"yyyymmdd")=A2&""),B2,"Invalid YYYYMMDD"),"Invalid YYYYMMDD") | Require eight characters, a year from 1901 onward, and an exact round trip |
If columns are cut off, scroll the table sideways.
| A: input | B: candidate | C: validated result |
|---|---|---|
| 20260901 | 09/01/2026 | 09/01/2026 |
| 20240229 | 02/29/2024 | 02/29/2024 |
| 20260229 | 03/01/2026 | Invalid YYYYMMDD |
| 20261301 | 01/01/2027 | Invalid YYYYMMDD |
| 20260900 | 08/31/2026 | Invalid YYYYMMDD |
| 2026091 | 11/30/2026 | Invalid YYYYMMDD |
| 20260901x | Blank (formula error) | Invalid YYYYMMDD |
If columns are cut off, scroll the table sideways.
- 20260901 becomes September 1, 2026, displayed as 09/01/2026. In a spare cell, =C2=DATE(2026,9,1) and =ISNUMBER(C2) should both return TRUE.
- DATE normalizes out-of-range parts: 20260229 becomes March 1 and 20261301 becomes January 1 of the next year. The TEXT round trip rejects those candidates because they do not reproduce the input.
- The validation example intentionally accepts years 1901–9999. It rejects blanks, short inputs, extra characters and 1900-era dates, including Excel’s fictitious 1900-02-29. Historical dates require a separate date-system policy.
- Test 20260901 as a number and as text by typing an apostrophe before it. Both should give the same result. Do not apply LEFT/MID/RIGHT to a cell that already stores a real date: that cell contains a serial number, not eight YYYYMMDD digits.
- The formulas use English Excel function names and comma argument separators, without LET or dynamic arrays. Localized Excel may need translated names and semicolons. Menu paths and date-format codes also depend on the locale.
- Number formatting leaves valid C cells numeric. =TEXT(C2,"mm/dd/yyyy") instead creates display text for export; keep C for date arithmetic. Review all invalid rows before copying validated results with Paste Special > Values.
Documentation reviewed .
Microsoft: DATE and YYYYMMDD conversionMicrosoft: Dates stored as textMicrosoft: Date display formatsMicrosoft: Excel’s 1900 leap-year exceptionGoogle Sheets: DATE numeric arguments
What this does
YYYYMMDD is an input layout: four year digits, two month digits and two day digits. Split those parts and build a new date value. A stored number such as 20260901 is not an Excel date serial, so applying a Date format to the original number cannot perform this conversion. Keep the original input column while reviewing the result. DATE also rolls impossible month and day values into other months or years; a formula that returns a date has not necessarily validated the input. Most people learn this as a sequence of clicks and forget it by next week; learning it as a pattern instead is what lets you apply it to the next, slightly different version of the problem without starting from scratch. That is the difference this page is trying to make. Treat “convert yyyymmdd to date in excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a data step that keeps your analysis trustworthy into a method you can reuse, explain, and defend when the workbook leaves your screen.
A worked example
A2 contains 20260901. The first four characters are 2026, the middle two are 09, and the last two are 01. The formula returns a real date that displays as 09/01/2026 with the mm/dd/yyyy number format. A4 containing 20260229 demonstrates the trap: plain DATE returns March 1, 2026. Use the candidate and round-trip validation columns in the copyable example to flag that row instead of accepting a different date. A date-code import becomes useful for sorting, filtering and date arithmetic only after its values become real dates. Preserving the source and rejecting impossible dates prevents a plausible-looking result from changing what the original record meant. Check the referenced cells, argument order and result type in your workbook. Start with the worked example before changing an input, then compare the changed result with the calculation you expected. An error value or a result of a different type is a reason to inspect the inputs and arguments.
In Google Sheets
Google Sheets support for this task has not been verified. Check the function, arguments and workflow in the target product before transferring the example. Matching formula notation does not establish identical behaviour. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. For “convert yyyymmdd to date in excel”, keep the input cells and the result visible while you check the formula in Excel. Follow the worked example and change one input at a time. The steps explain the workbook calculation; this page does not run a live calculator for that task.
Common mistakes
- Formatting 20260901 as Date without conversion: that treats the whole eight-digit code as a serial number.
- Accepting any DATE result as valid: February 29 in 2026 and month 13 normalize into different dates.
- Returning a concatenated string like "09/01/2026" and assuming it remains a numeric date for arithmetic and sorting.
- Splitting a genuine date value with
LEFT/MID/RIGHT: these functions see its underlying serial, not the displayed date. - Replacing the original import before checking invalid rows or silently truncating extra characters.
Frequently asked questions
What formula changes 20260901 to mm/dd/yyyy?
Use =DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)), then apply the mm/dd/yyyy number format to the result. It displays 09/01/2026 and remains a real date.
Does this work for a number and for text?
The sample accepts numeric 20260901 and text "20260901". Both must contain exactly eight YYYYMMDD digits. A real Excel date serial is a different input; format that date instead of splitting it.
Why does 20260229 return a date instead of an error?
DATE normalizes out-of-range parts. February 29, 2026 rolls to March 1. Compare the candidate formatted back as yyyymmdd with the original code; a mismatch means the original date was invalid.
How is this different from formatting a date as YYYYMMDD?
This task turns a YYYYMMDD code into a numeric date. Custom format yyyymmdd makes an existing date display as eight digits; TEXT(date,"yyyymmdd") produces export text. Those reverse-direction tasks start with a real date.
Does the formula require Microsoft 365?
It uses DATE, LEFT, MID and RIGHT, without LET or dynamic arrays. Microsoft documents the DATE conversion for Excel 2016, 2019, 2021, 2024 and Microsoft 365, including the listed Mac editions. This example uses English names and commas; other locales may require translated names and different separators. Documentation review is not a native Excel trial.
How should I adapt the recipe for Google Sheets?
Google documents numeric DATE arguments. Make conversion explicit with =DATE(VALUE(LEFT(A2,4)),VALUE(MID(A2,5,2)),VALUE(RIGHT(A2,2))) and apply a date number format. DATE also normalizes invalid month/day inputs in Sheets. The complete validation sample has not been runtime-tested there; check both valid and invalid rows and the workbook locale before relying on it.