Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Extract Year from dd/mm/yyyy: 3 Easy Methods

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To extract the year from a date formatted as dd/mm/yyyy in Excel, use the =YEAR() function. For example, if your date is in cell A2, enter =YEAR(A2) into another cell and press Enter. This achieves a clean, numerical extraction of the year, allowing you to group data, perform annual calculations, or filter records by a specific calendar year. This process requires that Excel recognizes your input as a valid date rather than a simple text string.

What You'll Need

  • Microsoft Excel (any modern version, including Office 365, 2021, 2019, or Excel for the Web).
  • A dataset containing dates formatted as dd/mm/yyyy.
  • A blank column adjacent to your dates to house the extracted year values.

Step-by-Step

Method 1: Using the YEAR Function (The Standard Way)

The YEAR function is the most reliable method because it treats the date as a serial number, ensuring accuracy regardless of how the date is visually formatted in the cell.

  1. Select the cell where you want the year to appear (e.g., cell B2 if your date is in A2).
  2. Type =YEAR( into the cell.
  3. Click on the cell containing the date (A2) or type the cell reference manually.
  4. Close the parenthesis by typing ) so the formula looks like =YEAR(A2).
  5. Press Enter. Excel will now display the four-digit year (e.g., 2023).
  6. To apply this to the rest of your list, hover your mouse over the bottom-right corner of cell B2 until a small black cross (the Fill Handle) appears.
  7. Double-click the Fill Handle or click and drag it down to the end of your data range.

Method 2: Using Text-to-Columns (The No-Formula Way)

If you do not want to use formulas and simply want to split the date into separate columns, Text-to-Columns is the fastest approach. Note that this method modifies your data, so it is recommended to copy your date column first.

  1. Highlight the column containing your dd/mm/yyyy dates.
  2. Navigate to the Data tab on the top ribbon.
  3. Click on Text to Columns in the Data Tools group.
  4. In the wizard that appears, select Delimited and click Next.
  5. Under the Delimiters section, uncheck all boxes and check Other. In the small box next to "Other", type a forward slash (/).
  6. Click Next. You will see a preview showing the date split into three columns (Day, Month, Year).
  7. In the Destination box, change the cell reference (e.g., from $A$1 to $B$1) if you want to keep the original date column intact.
  8. Click Finish. The year will now be in its own standalone column.

Method 3: Using Custom Formatting (Visual Extraction Only)

If you need the cell to still function as a full date for calculations but only want it to look like a year, use custom formatting. This does not actually "extract" the data into a new value, but it changes the display.

  1. Select the cells containing your dates.
  2. Right-click the selection and choose Format Cells... (or press Ctrl + 1).
  3. In the Number tab, select Custom from the Category list on the left.
  4. In the Type field, delete whatever is currently there and type yyyy.
  5. Click OK. The cells will now only display the year, though the formula bar will still show the full dd/mm/yyyy date.

Common Mistakes

One of the most frequent errors is attempting to use the YEAR function on a date that Excel perceives as "Text." If your date was imported from a CSV or a web database, it might look like a date to you, but Excel sees it as a string of characters. In this case, the =YEAR() formula will return a #VALUE! error. This happens because the function requires a numeric date serial number to operate.

Another common mistake is failing to adjust the cell format after using the YEAR function. Sometimes, Excel tries to be helpful and formats the result cell as a "Date" instead of a "General" or "Number." If you see a date like 05/07/1905 instead of 2023, it is because Excel is treating the number 2023 as a date serial number (which corresponds to a date in the year 1905). To fix this, change the cell format back to General.

Lastly, users often confuse the YEAR() function with the TEXT() function. While =TEXT(A2, "yyyy") also works, it converts the year into a text string. This means you cannot easily use that result in mathematical calculations (like adding 1 to the year) without first converting it back to a number.

Tips

To ensure your dates are recognized correctly before you start, select your date column and look at the alignment. By default, Excel aligns numbers and dates to the right and text to the left. If your dd/mm/yyyy dates are aligned to the left, they are likely stored as text and will need to be converted using the Value function or the Text-to-Columns tool before the YEAR function will work.

If you are working with a massive dataset (thousands of rows), avoid using volatile formulas if possible. While YEAR is not particularly resource-heavy, converting formulas to static values can speed up your workbook. Once you have extracted the years, you can select the column, copy it (Ctrl + C), and then right-click and select Paste Values. This removes the formula but keeps the year, preventing Excel from recalculating the entire sheet every time you make a change.

For those who want more flexibility, the =TEXT(A2, "yyyy") formula is excellent for concatenating. For example, if you want a cell to say "Year: 2023", you can use ="Year: " & TEXT(A2, "yyyy"). This is much cleaner than trying to combine a number and text using the standard YEAR function.

Troubleshooting

If the formula returns #VALUE!, your date is stored as text. To fix this, select the column of dates, go to the Data tab, select Text to Columns, click Next twice to get to Step 3, select Date, choose DMY from the dropdown, and click Finish. This forces Excel to convert the text strings into actual date values.

If the formula returns a date like 05-Jul-1905, the cell is formatted as a date. Go to the Home tab, find the Number format dropdown (which likely says "Date"), and change it to General. This will reveal the four-digit year.

If the formula returns #NAME?, check your spelling. Ensure you have typed =YEAR( and not =YREAR( or another misspelling. This error specifically means Excel does not recognize the function name you have entered.

If you are using a non-English version of Excel, the function name will be different. For example, in Spanish, the function is =AÑO(); in French, it is =ANNEE(). If the English formula doesn't work, check your local language's Excel function library.

Frequently Asked Questions

Can I extract the year if my date is in a different format like mm/dd/yyyy?

Yes. The =YEAR() function works regardless of the display format (dd/mm/yyyy or mm/dd/yyyy), provided that Excel recognizes the cell as a valid date. The function looks at the underlying serial number, not the visual arrangement of the day and month.

How do I extract only the last two digits of the year?

The YEAR function always returns four digits. To get only the last two, use the TEXT function: =TEXT(A2, "yy"). This will turn 2023 into "23".

Will the extracted year update automatically if I change the date?

Yes, if you used the =YEAR() formula, the result is dynamic. If you change the date in cell A2, the year in cell B2 will update instantly. If you used the Text-to-Columns method, the value is static and will not change.

Can I extract the year from a date that is part of a longer text string?

If the date is embedded in text (e.g., "Order placed on 12/05/2023"), the YEAR function will not work directly. You would first need to use a combination of MID, LEFT, or RIGHT functions to isolate the date string, wrap that in a DATEVALUE function, and then apply the YEAR function.

Is there a way to extract the year using a Pivot Table?

Yes. If you add a date field to the Rows area of a Pivot Table, modern versions of Excel automatically group dates into Years, Quarters, and Months. You can right-click any date in the Pivot Table and select Group... to choose exactly which time increments you want to display.