Function Problems

Fix Excel Formula That Converts an Eight-Digit Value to a Date in WPS Office

Kushani NimanthikaKushani Nimanthika Nov 13, 2026 869 views

Question details

The user needs to correct an Excel formula that converts an eight-digit value such as 20220502 into a valid date by extracting the year, month, and day segments.

Fix Excel Formula That Converts an Eight-Digit Value to a Date
Product
WPS Office Spreadsheets
Device & OS
not provided
Scenario
The user has an eight-digit value such as 20220502 in a worksheet cell and needs it to appear as a valid Excel date, for example 2022-05-02.
Observed behavior
The current formula does not return the expected date, typically because the month extraction starts at character 3 instead of character 5 and the formula is missing a closing parenthesis.
Before you start

Before editing the formula, verify that the source value follows a consistent YYYYMMDD format and identify the correct cell reference, such as A221.

Solution 1Recommended

Correct the DATE formula with LEFT, MID, and RIGHT

Use this solution when the eight-digit value is being parsed incorrectly or the formula returns an error instead of a valid date.

The DATE function creates a valid date from separate year, month, and day values. In an eight-digit YYYYMMDD value, the month segment starts at character 5, not character 3.

1
Select the result cell

Click the cell where you want the converted date to appear, such as B221.

2
Enter the corrected DATE formula

Type =DATE(LEFT(A221,4),MID(A221,5,2),RIGHT(A221,2)) and press Enter.

3
Verify the month start position

Make sure the MID function uses 5 as the start position so it reads characters 5 and 6 as the two-digit month.

4
Format the cell as a date

With the result cell selected, go to Home > Number Format and choose Short Date or Long Date.

Correct the DATE formula with LEFT, MID, and RIGHT
Date conversion fixed: The eight-digit value 20220502 should now display as a valid date such as 5/2/2022 or 2022-05-02, depending on your chosen date format.
WPS Office Spreadsheets date formula fix

Correct the Excel Date Formula in WPS Office Spreadsheets

Open the affected workbook in WPS Office Spreadsheets and use the DATE(LEFT(A221,4),MID(A221,5,2),RIGHT(A221,2)) formula to convert an eight-digit YYYYMMDD value into a valid date, then format the result cell as a date.

  1. 1. Open WPS Office Spreadsheets: Launch WPS Office and open the workbook that contains the eight-digit date value.
  2. 2. Enter the corrected DATE formula: In a blank cell, type =DATE(LEFT(A221,4),MID(A221,5,2),RIGHT(A221,2)) and press Enter.
  3. 3. Apply a date format: Select the result cell, click Home > Number Format, and choose Short Date or Long Date.
  4. 4. Save the workbook: Save the file as .xlsx to keep the formula and date formatting compatible with Excel.
Converts eight-digit YYYYMMDD values with Excel-compatible functionsFull compatibility with .xlsx, .xls, and .csv date workbooksFree, lightweight Office suite with a familiar spreadsheet interfaceQuick date formatting from the Home tab without complex setup
microsoft office alternative - wps office

Frequently Asked Questions

Why does my existing formula return #VALUE! when converting 20220502?

The most common cause is that the MID function starts at character 3 instead of character 5, so it reads the wrong month segment. Use =DATE(LEFT(A221,4),MID(A221,5,2),RIGHT(A221,2)) and confirm the source cell contains exactly eight digits.

How do I display the result as a date instead of a number?

Select the result cell, go to Home > Number Format, and choose Short Date or Long Date. Excel stores dates as serial numbers, so the date format must be applied manually.

Can I use this formula for a whole column of eight-digit values?

Yes. Enter the formula in the first row and drag the fill handle down to copy it. The cell references update automatically.

Does this formula work in both WPS Office and Microsoft Excel?

Yes. DATE, LEFT, MID, and RIGHT are standard Excel-compatible functions and are supported in WPS Office Spreadsheets.

What if my eight-digit value has leading zeros or inconsistent spacing?

Store the value as text in a consistent YYYYMMDD format. If needed, use TEXT(A221,"00000000") to normalize leading zeros before applying the DATE formula.