Extract (Get) Year or Month from a Date in Excel (Formula)

Last Updated: March 24, 2024
puneet-gogia-excel-champs

- Written by Puneet

When you are working in Excel, you might need to get the year only from a date. Well, there’s a simple formula that you can use to do this. In this tutorial, we will look to extract a year or a month from a date in Excel.

year-from-date

Extract Year from a Date

To get the year from the date that you have in cell A1, use the following steps:

  1. First, edit cell B1, and enter the “=”.
  2. After that, enter the YEAR function and the starting parentheses.
  3. Now, refer to cell A1 where you have the date.
  4. In the end, enter closing parentheses and hit enter to get the result.
extract-year-from-date
=YEAR(A1)

Extract Month from a Date

If you have a date in cell A1 and you want to extract month it, use the following steps:

  1. First, in cell B1, enter “=”.
  2. After that enter the MONTH function and starting parentheses.
  3. Now, refer to cell A1 where you have the date.
  4. In the end, enter closing parentheses and hit enter to get the result.
extract-month-from-date
=MONTH(A1)

Use TEXT Function to Get Year or a Month from Date

Apart from the functions that we have discussed above, you can use the TEXT to get year and month from date. In the text function, you have two arguments to define, the first is the date, and the second is the format_text that you want to extract from the date.

In the following example, you have the text function with the format_text “YYYY” that returns the year in four digits.

text-function-to-get-year

And if you want to get a year in two digits, you can use the following format_text.

text-function-two-digit-year

In the same way, you can use the format_text “MMM” to get the month value from the date.

text-function-to-get-month

To get a month in the full name.

full-month-name

And only get the number in the result.

get-month-in-number

Use Custom Formatting Get Year or a Month a Date

You can also use custom formatting to convert a date into a year or a month. This method shows only the year, or month for a date that you have in the cell.

custom-formatting-to-get-year
  1. Select the cell or range of cells where you have the dates.
  2. Open the Format Options by using the Ctrl + 1.
  3. Click on the Custom option and then click on the type of input bar “YYYY”.
  4. And then click OK.

The moment you click OK, it shows you the year instead of the whole date.

show-year-only

And in the same way, you can enter the month format in the “Type” input bar to show the month instead of the date.

enter-month-in-input-bar

Get the Excel File