To get the year only in Excel, use the =YEAR(cell) formula to extract the numerical year from a date, or use a Custom Number Format (yyyy) to change how a date looks without changing the underlying data. The formula method creates a new value you can use for calculations, while the formatting method is purely visual.

What You'll Need

  • Microsoft Excel (any version, including Excel for the Web, Excel for Mac, or Excel for Windows).
  • A dataset containing dates formatted as valid Excel date values (not as plain text).
  • An empty column adjacent to your dates if you plan to use the formula method.

Step-by-Step

Method 1: Using the YEAR Function (Best for Data Analysis)

Use this method when you need the year as a standalone number to use in Pivot Tables, filters, or other mathematical formulas. This process extracts the year and places it in a separate cell.

  1. Click on the empty cell where you want the year to appear (for example, if your date is in cell A2, click cell B2).
  2. Type the equals sign = to start the formula.
  3. Type YEAR(.
  4. Click on the cell containing the full date (e.g., A2) or type the cell reference manually.
  5. Type the closing parenthesis ). The full formula should look like =YEAR(A2).
  6. Press Enter. Excel will now display the four-digit year (e.g., 2024).
  7. To apply this to an entire column, hover your mouse over the bottom-right corner of the cell until you see a small black cross (the Fill Handle). Double-click the cross or click and drag it down to the end of your data set.

Method 2: Using Custom Number Formatting (Best for Visuals)

Use this method if you want the cell to look like it only contains the year, but you want Excel to still remember the full date (month and day) for internal calculations. Note that labels can differ slightly by version, device, or region.

  1. Select the cell or range of cells containing the dates you wish to change.
  2. Open the Format Cells dialog. You can do this by right-clicking the selection and choosing Format Cells... or by pressing Ctrl + 1 (Windows) or Cmd + 1 (Mac).
  3. In the Category list on the left side of the window, click on Custom.
  4. Locate the Type: input box on the right side. Delete whatever text is currently in that box.
  5. Type yyyy into the box. (Using four 'y's ensures a four-digit year like 2026; using two 'y's would show 26).
  6. Click OK. The dates in your cells will now display only the year, though the formula bar will still show the full date.

Method 3: Using Text-to-Columns (Best for Permanent Conversion)

If you have a list of dates and you want to permanently strip away the month and day without using formulas, you can split the data.

  1. Select the column containing your dates.
  2. Go to the Data tab on the top ribbon.
  3. Click the Text to Columns button.
  4. Choose Delimited and click Next.
  5. Select the delimiter that separates your date parts (usually a forward slash / or a hyphen -). You will see a preview of the data splitting into columns. Click Next.
  6. In the Data Preview section, click on the column containing the year. Under Column data format, select General.
  7. Click Finish. Your date will now be split into three separate columns: day, month, and year. You can then delete the day and month columns.

Common Mistakes

One of the most frequent errors occurs when users try to use the =YEAR() function on a cell that Excel perceives as text rather than a date. If your date is aligned to the left of the cell by default, it is likely stored as text. In this case, the =YEAR() formula will return a #VALUE! error because it cannot perform a mathematical operation on a text string.

Another common mistake is confusing the Custom Formatting method with the Formula method. Users often apply yyyy formatting and then wonder why their Pivot Table still groups the data by month and day. This happens because formatting only changes the "mask" of the cell; the underlying value remains the full date. For actual data grouping, the formula method is required.

Finally, some users accidentally use the TEXT function incorrectly. While =TEXT(A2, "yyyy") works, it converts the year into a text string. This means you cannot use that result in a SUM or AVERAGE function, and it will not sort numerically in some advanced scenarios.

Tips

To make your spreadsheet more dynamic, consider using a Table (Ctrl + T). When you enter the =YEAR() formula in a Table column, Excel automatically fills the formula down to every row in that column, saving you from dragging the Fill Handle manually.

If you need the year for a specific calculation, such as calculating age, do not just subtract the years. Instead, use the DATEDIF function: =DATEDIF(A2, TODAY(), "y"). This ensures that the age only increments once the actual birthday has passed in the current year, providing a much more accurate result than simply subtracting the birth year from the current year.

For those working with very large datasets, using a Helper Column with the =YEAR() function is generally faster and less prone to errors than using complex array formulas. Once you have extracted the years, you can copy the column and use Paste Special > Values to remove the formulas and keep only the numbers, which reduces the file size and prevents the sheet from recalculating every time you make a change.

Troubleshooting

If your formula returns a strange date (like 07/05/1905) instead of a year (like 2024), the cell is likely formatted as a Date. Excel sees the result of =YEAR(A2) as the number 2024. In Excel's date system, the number 2024 represents the 2,024th day after January 1, 1900. To fix this, select the cell, go to the Home tab, and change the Number Format dropdown from Date to General or Number.

If you receive a #VALUE! error, check the original date cell. If the date was imported from another software, it might have hidden spaces. Try using the =TRIM() function or the Find and Replace tool to remove any non-standard characters. You can also try the Value function: =YEAR(VALUE(A2)), which forces Excel to attempt to convert a text-based date into a numeric date before extracting the year.

If the yyyy custom format is not working, ensure that the cell actually contains a date. If you type "January 1st 2024" as a sentence, Excel treats it as text, and custom number formats will have no effect. Use a standard date format like 1/1/2024 to ensure the formatting engine can recognize the value.

Frequently Asked Questions

Can I extract the year from a date that is written as text?

Yes, but the =YEAR() function may fail. You can use the =RIGHT(A2, 4) function if the year is always the last four characters of the cell, or use =YEAR(DATEVALUE(A2)) to convert the text to a date first.

Does the YEAR function work in Google Sheets too?

Yes, the =YEAR() function is standardized across most spreadsheet software, including Google Sheets and LibreOffice Calc, and works identically.

How do I get a 2-digit year instead of 4?

For formatting, use yy instead of yyyy. For a formula, you can use =RIGHT(YEAR(A2), 2), though this converts the result into text.

Why is my year showing up as a decimal?

This happens if the cell is formatted as a Number with decimal places. Change the cell format to General or use the Decrease Decimal button on the Home tab to hide the decimals.

Can I use the YEAR function inside a SUMIF formula?

Not directly on the range. SUMIF requires a physical range of cells. You must first create a helper column using =YEAR() and then run your SUMIF or COUNTIF on that new column.