Extract Month and Year from Date in Excel: Easy Methods
In this article
To extract the month and year from a date in Excel, use the =MONTH() and =YEAR() functions for numerical values, or the =TEXT() function to get names like "January" or "2024". These tools allow you to break down a full date (e.g., 12/05/2026) into separate columns for better sorting, filtering, and reporting.
What You'll Need
- Microsoft Excel (any modern version)
- A dataset containing dates formatted as valid Excel date values
- Empty columns adjacent to your dates to house the extracted data
Step-by-Step
Depending on whether you want a number (for calculations) or text (for labels), choose one of the following three methods. Note that menu labels and function behavior may vary slightly depending on your version of Excel or regional settings.
Method 1: Extracting Numerical Month and Year
Use this method if you need the month and year as numbers to use in further mathematical formulas or pivot tables.
- Click on the empty cell where you want the month to appear (e.g., cell B2 if your date is in A2).
- Type
=MONTH(A2)and press Enter. Excel will return a number from 1 (January) to 12 (December). - Click on the empty cell where you want the year to appear (e.g., cell C2).
- Type
=YEAR(A2)and press Enter. Excel will return the four-digit year (e.g., 2026). - Select both cells, click the small green square (fill handle) in the bottom-right corner of the selection, and drag it down to apply the formula to the rest of your list.
Method 2: Extracting Month and Year as Text (Names)
Use this method if you want the month to appear as "January" or "Jan" and the year as a text string.
- Click on the empty cell where you want the month name to appear.
- Type
=TEXT(A2, "mmmm")for the full month name (e.g., December) or=TEXT(A2, "mmm")for the abbreviated name (e.g., Dec). Press Enter. - Click on the empty cell where you want the year to appear.
- Type
=TEXT(A2, "yyyy")and press Enter. - Drag the fill handle down to complete the column.
Method 3: Combining Month and Year into One Cell
If you need a single label like "December 2026" for a report, use the TEXT function to combine them.
- Click on the target empty cell.
- Type
=TEXT(A2, "mmmm yyyy")and press Enter. - This creates a text string that combines both elements into one readable format.
Common Mistakes
- Using the wrong cell reference: Ensure the cell inside the parentheses (e.g., A2) matches the cell where your date is actually stored.
- Applying formulas to text dates: If your date was typed as "Dec 5th 2026" instead of a standard date format (like 12/05/2026), Excel treats it as text. The
MONTHandYEARfunctions will return a #VALUE! error because they cannot perform math on text. - Forgetting the quotes: In the
=TEXT()function, the format code (like "mmmm") must be enclosed in double quotation marks. - Incorrect Fill Handle usage: If you drag a formula down and see the same result repeated, check if your "Calculation Options" (under the Formulas tab) is set to "Manual" instead of "Automatic."
Tips
- Convert Formulas to Values: Once you have extracted the month and year, the cells still rely on the original date. If you delete the original date column, your extracted data will break. To fix this, copy the extracted cells, right-click, and select Paste Values.
- Custom Formatting: If you don't want to use formulas, you can simply change how a date looks. Right-click a cell > Format Cells > Number tab > Custom. Type "mmmm" to show only the month, though the cell still technically contains the full date.
- Sorting Text Months: Be aware that if you use
=TEXT(A2, "mmmm"), Excel will sort these alphabetically (April, August, December) rather than chronologically. To sort chronologically, use the numerical=MONTH()method.
Troubleshooting
If the formulas are not working as expected, try these steps in order:
- Check for #VALUE! errors: This usually means your "date" is actually stored as text. To fix this, select the date column, go to the Data tab, select Text to Columns, click Next twice, select Date (MDY or DMY depending on your region), and click Finish.
- Check for strange numbers: If
=MONTH()returns a date like "January 1, 1900" instead of the number 1, the cell is formatted as a Date. Change the cell format to General or Number using the dropdown menu on the Home tab. - Check for #NAME? errors: This happens if the function name is misspelled. Ensure you have typed
MONTH,YEAR, orTEXTcorrectly.
Frequently Asked Questions
Can I extract the month and year without using formulas?
Yes, you can use the Flash Fill feature. Type the month of the first two dates in a new column, then press Ctrl+E. Excel will detect the pattern and fill the rest of the column automatically.
Why does my month show up as a date instead of a number?
Excel often tries to be helpful by applying "Date" formatting to any cell that references a date. Change the cell format to "General" in the Home tab to see the actual month number.
How do I get a two-digit year instead of four?
In the =TEXT() function, use "yy" instead of "yyyy". For example: =TEXT(A2, "yy") will return "26" instead of "2026".
Can I extract the quarter of the year?
Excel doesn't have a built-in QUARTER function, but you can use: =ROUNDUP(MONTH(A2)/3,0). This divides the month by 3 and rounds up to give you quarters 1 through 4.
Does this work in Google Sheets?
Yes, the =MONTH(), =YEAR(), and =TEXT() functions work identically in Google Sheets as they do in Microsoft Excel.