Sorting text-based month names in Excel often results in frustrating alphabetical ordering rather than chronological flow. While users typically rely on rigid custom lists or manual adjustments to bypass this, these standard methods lack dynamic flexibility. Utilizing the DATEVALUE function grants an elegant, automated solution by converting text into sequential serial numbers for flawless sorting. For successful execution, Excel stipulates that the text must represent a recognizable date; for example, appending a day to the month, such as =DATEVALUE(A2&" 1"), converts "January" into a sortable numeric value. Below, we outline the exact formula steps to streamline your dataset.
When working with financial reports, sales pipelines, or monthly summaries in Excel, you often find yourself dealing with lists of month names. While text-based month names like "January," "February," and "March" are highly readable for humans, they present a notorious challenge when you try to sort them in Microsoft Excel.
By default, if you attempt to sort a column of month names, Excel treats them as standard text strings. The result? Your chronological calendar is sorted alphabetically: April, August, December, February, January, and so on. This ruins the chronological flow of your reports.
While Excel offers built-in Custom Lists to solve this, they can be clunky, aren't always portable across different workbooks, and don't work dynamically inside formulas. Fortunately, there is an elegant, formula-based solution using the DATEVALUE function. In this comprehensive guide, we will explore how to use the DATEVALUE function to sort month names chronologically, both in legacy Excel setups and using dynamic arrays in modern Excel (Office 365).
Excel is highly efficient at sorting dates because, under the hood, it stores dates as sequential serial numbers. For example, January 1, 1900, is stored as serial number 1, and January 1, 2026, is stored as 46023. When you sort actual dates, Excel simply sorts these underlying numbers.
However, when your cells contain plain text strings like "January" or "Feb", Excel has no native understanding that "February" should follow "January". It sees them as raw text and applies alphabetical sorting rules. To fix this, we need a way to temporarily convert those text strings into date serial numbers or month index numbers (1 through 12). This is where the DATEVALUE function shines.
The DATEVALUE function is designed to convert a date that is stored as text into a serial number that Excel recognizes as a date. The syntax is straightforward:
=DATEVALUE(date_text)
The key to using this function with raw month names is that DATEVALUE requires a complete date structure (day, month, and year) to work correctly. If you pass just "January" to the function, it will return a #VALUE! error. To make it work, we must append a day and a year to the text using concatenation.
By appending a day (such as "1") to our month text, we construct a recognizable date string. For example:
=DATEVALUE(A2 & " 1")
If cell A2 contains "January", the formula evaluates A2 & " 1" as "January 1". Excel automatically assumes the current calendar year and converts "January 1, [Current Year]" into its respective date serial number. Once you have this serial number, you can easily sort your data chronologically.
If you are using older versions of Excel (such as Excel 2013, 2016, or 2019), the most robust approach is to create a helper column. This column converts the month names into sortable date values.
A2, enter the following formula in your helper column (cell B2):
=DATEVALUE(A2 & " 1")
Note: This formula works perfectly for both full month names ("January") and three-letter abbreviations ("Jan").
Your entire table will now automatically sort chronologically from January to December. If desired, you can hide the helper column to keep your sheet clean.
While sorting by serial numbers works perfectly, some users prefer to see a clean month index (1 for January, 2 for February, etc.) in their helper columns. You can easily achieve this by nesting your DATEVALUE formula inside the MONTH function.
The MONTH function extracts a number from 1 to 12 from any valid Excel date. Use this formula in your helper column:
=MONTH(DATEVALUE(A2 & " 1"))
DATEVALUE function, which relies on the current calendar year, the MONTH function always returns a clean integer from 1 to 12. This ensures your sorting logic remains unchanged regardless of what year the system clock is set to.If you are using modern Excel (Microsoft 365 or Excel for the Web), you don't need helper columns at all. You can use dynamic array formulas to sort your month list automatically and dynamically.
The SORTBY function allows you to sort an array based on the values in a corresponding array. Here is how to write the formula:
=SORTBY(A2:B13, MONTH(DATEVALUE(A2:A13 & " 1")))
A2:B13: This is the range of data you want to sort (e.g., Month Names in column A and Sales Data in column B).A2:A13 & " 1": This creates an in-memory array of date strings ("January 1", "February 1", etc.).DATEVALUE(...): Converts those text strings into date serial numbers on the fly.MONTH(...): Converts the serial numbers into an array of integers (1 through 12).SORTBY(...): Takes your original data and sorts it based on the array of month numbers generated behind the scenes.This method is highly dynamic. If you change a month name in your source table, the sorted list will automatically recalculate and reorder itself instantly without manual sorting steps.
While using DATEVALUE to sort month names is incredibly useful, you may run into a few common pitfalls. Here is how to diagnose and fix them:
If your formula returns a #VALUE! error, it means Excel cannot interpret the text string as a date. This is usually caused by:
DATEVALUE("January 1") will fail. Fix this by wrapping your cell reference in the TRIM function:
=DATEVALUE(TRIM(A2) & " 1")
If your dataset contains blank rows or non-date text, the formula will break. To prevent this, you can wrap your calculation inside an IFERROR or IF statement to keep your spreadsheet clean:
=IF(A2="", "", MONTH(DATEVALUE(A2 & " 1")))
To help you choose the best approach for your specific project, here is a quick comparison table of the methods discussed:
| Method | Formula | Excel Compatibility | Pros / Cons |
|---|---|---|---|
| Raw DATEVALUE Helper | =DATEVALUE(A2 & " 1") |
All Versions | Simple, but displays confusing five-digit date serial numbers. |
| MONTH + DATEVALUE Helper | =MONTH(DATEVALUE(A2 & " 1")) |
All Versions | Produces clean month index numbers (1-12) which are easy to read and sort. |
| Dynamic SORTBY Array | =SORTBY(A2:B13, MONTH(DATEVALUE(A2:A13 & " 1"))) |
Office 365 / Web | No helper columns needed; updates dynamically. Doesn't work on older Excel versions. |
Sorting month names chronologically in Excel doesn't have to be a manual headache. By leveraging the DATEVALUE function, you can quickly convert text strings into actionable chronological data. Whether you choose to use a classic helper column with MONTH(DATEVALUE()) or implement a cutting-edge dynamic array solution using SORTBY, these formulas will save you time and keep your professional spreadsheets accurate, dynamic, and perfectly ordered.
Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.