Function Problems

Compare Birth Years from Excel Dates and Text Values

John WilsonJohn Wilson Nov 18, 2026 869 views

Question details

Compare the year in an Excel date with the first four characters of a text or numeric value.

Compare Birth Years from Excel Dates and Text Values
Product
Microsoft Excel
Device & OS
not provided
Scenario
One column contains birth dates, and another contains values that begin with a four-digit birth year.
Observed behavior
Matching years should return a blank result, while different years should be marked with D.
Before you start

Check that column A contains real Excel dates and that the first four characters in column B are the birth year. Place the formula in an empty column so it does not overwrite your data.

Solution 1Recommended

Compare birth years with a formula in each row

Use this formula in most Excel versions and fill it down for all rows.

1
Enter the comparison formula

In an empty cell such as C1, enter =IF(YEAR(A1)=VALUE(LEFT(B1,4)),"","D"). Adjust A1 and B1 if your first data row uses different cells.

2
Fill the formula down

Select C1 and drag its fill handle down alongside the remaining rows, or double-click the fill handle.

3
Review the results

Look down column C: D identifies a different year, while a blank result means the years match.

Compare birth years with a formula in each row
Check invalid values: YEAR requires a valid Excel date, and VALUE requires the first four characters to be convertible to a number. Invalid entries can produce an error.
Compare years in WPS Spreadsheets

Flag different birth years in WPS Spreadsheets

Use YEAR, LEFT, and VALUE in WPS Spreadsheets to compare a date with a value beginning with a four-digit year, then fill the formula down.

  1. 1. Open your workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
  2. 2. Enter the formula: In an empty cell such as C1, enter =IF(YEAR(A1)=VALUE(LEFT(B1,4)),"","D"). Adjust the cell references for your data.
  3. 3. Fill and review: Drag the fill handle from C1 down through your data and check column C for D markers.
  4. 4. Save the workbook: Select Menu > Save or Save As to save the results in your chosen workbook format.
Flag birth-year differences with a single formula per rowOpen and edit Microsoft Excel XLSX and XLS filesFill formulas down across multiple recordsUse a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula return D?

D means the year extracted from the date in column A differs from the number formed by the first four characters in column B.

Why am I getting a formula error?

Check that the cell in column A contains a valid Excel date and that the first four characters in column B can be converted to a number. Correct the source cells and recalculate.

Can the value in column B be a number instead of text?

Yes. LEFT can read the first four characters of a numeric value, and VALUE converts those characters to a number for comparison. Check that the displayed value begins with the intended four-digit year.

Why does the MAP formula show a spill error?

Clear any occupied cells in the intended spill range below the formula. Also check that both input ranges cover the same number of rows.