You can extract the month number (1-12) using the TEXT function, convert the date to a full month name, or get the three-letter abbreviation. The most direct formula is `=TEXT(A1,"mm")` for the month number. This works immediately in any modern version of Excel, Google Sheets, or LibreOffice Calc, provided the cell contains a valid date value (e.g., 2023-10-25 or 10/25/2023) rather than just text that looks like a date. Excel stores dates internally as serial numbers, which allows these formulas to function reliably.

What You'll Need

  • A modern spreadsheet application (Microsoft Excel, Google Sheets, or LibreOffice Calc).
  • A dataset containing at least one column of long date values (e.g., "2023-12-15 14:30" or "January 5, 2024").
  • A cell to write the formula into.

Step-by-Step

  1. Locate your data: Open your spreadsheet and navigate to the cell containing the long date you want to process. This cell might be labeled A1, B5, or any other cell in your dataset. For this guide, we will assume the date is in cell A1 to keep the instructions clear.
  2. Click the target cell: Click on the empty cell where you want the month number or name to appear. This is the cell that will hold your new formula. The result will appear here once the formula is entered correctly.
  3. Start the formula: Type the equals sign (=) into the selected cell. This signals to the spreadsheet that you are about to enter a formula rather than just plain text.
  4. Insert the function: Type TEXT followed by an opening parenthesis ((). The formula should now look like =TEXT(.
  5. Select the date cell: Click on the cell containing your long date (cell A1). The reference A1 will appear immediately after the opening parenthesis. If you are working with a list of dates, you can click and drag to select multiple cells, but for a single result, one cell is sufficient. The formula should look like =TEXT(A1,.
  6. Add the format code: Type a comma (,) to separate the value argument from the format argument, and then type the format code inside double quotation marks. The format code determines exactly what information is extracted. The most common codes are listed below:
  7. Extract the Month Number (1-12): For a single-digit month number (e.g., 5 for May), use the code "mm". The full formula is =TEXT(A1,"mm").
  8. Extract the Month Number with Leading Zero (01-12): For a two-digit month number (e.g., 05 for May), use the code "mmmm". The full formula is =TEXT(A1,"mm").
  9. Extract the Full Month Name: For the full name of the month (e.g., May), use the code "mmmm". The full formula is =TEXT(A1,"mmmm").
  10. Extract the Three-Letter Abbreviation: For the abbreviated month name (e.g., May), use the code "mmm". The full formula is =TEXT(A1,"mmm").
  11. Complete the formula: Type the closing parenthesis () and press the Enter key on your keyboard. The month value will now appear in your selected cell.
  12. Apply to a range: If you have a column of dates, click and drag the bottom-right corner of the cell containing your new formula down to copy the formula to the other cells. The result will update automatically for each corresponding date.

Common Mistakes

The most frequent error users encounter is confusing the month codes with day codes. The code "mm" extracts the month, while "mm" (with only one m) actually extracts the minute from a time value. If your cell contains both a date and a time (e.g., 5/25/2023 2:30 PM), the "mm" code will return the minute (30) instead of the month (05). To ensure you get the month, always use "mmmm" for the full name or "mm" for the number, and ensure the date value is the primary component.

Tips

When working with date data that has been imported from a database or a text file, the dates might appear as text strings that Excel does not recognize as dates. If the formula returns an error like #VALUE! or the cell displays the raw text, the cell is not a valid date object. You can often fix this by using the DATEVALUE function as a wrapper. For example, change your formula to =TEXT(DATEVALUE(A1),"mm"). This converts the text string into a valid Excel date so the TEXT function can read it.

Troubleshooting

If the formula returns an error, first check that the cell A1 actually contains a date. If the cell contains text like "May 2023" or "5/2023", Excel will not be able to parse the month. You can verify the data type by clicking on the cell and looking at the formula bar. If the formula bar shows the date as a serial number (like 44927) or the date format (like 5/25/2023), the data is correct. If the formula bar shows the text exactly as it appears in the cell, you must convert the data to a date value using the DATEVALUE function as described in the Tips section.

Frequently Asked Questions

How do I get the month name in all caps?

Excel does not have a built-in option to force text to all caps within a formula. To get the month name in all caps, you can add the UPPER function to your existing TEXT formula. For example, =UPPER(TEXT(A1,"mmmm")) will return "JANUARY" instead of "January".

Why does my formula show "mm" instead of the month number?

If your cell contains a time component (e.g., 5/25/2023 3:45 PM), the code "mm" refers to minutes, not months. To force the formula to read the month, you must use the format code "mmmm" for the name or "mm" for the number. These codes are specific to month and day, respectively, and will not be confused by time values.

Can I use this formula in Google Sheets?

Yes, the TEXT function and its format codes work identically in Google Sheets as they do in Microsoft Excel. The steps to enter the formula and the exact results you will see are the same in both applications.