bottom
Great ExcelTips!
         
Your e-mail address is safe!
Close Note

Tips.Net > ExcelTips Home > Sorting > Sorting Dates by Month

Sorting Dates by Month

Summary: Do you need to sort information in a worksheet by month name when all you have available in a column is a group of dates? You can do so by applying any of the techniques described in this tip. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)

At sometime you may have a need to sort a list of information based on the month represented in a particular column. For instance, you may have a list of people and their birthdays, and you want to sort the list by birthday month so that you knows whose birthdays occur within a particular month.

The easiest way to do this is to add a new column to your table. This column will be named something descriptive, such as "Birth Month" or simply "Month." For instance, let's say that you have people's birthdays in column B, you could add the new column in column C. In this column you could then use the MONTH function, as follows:

=MONTH(B3)

This particular formula would go in cell C3, but similar formulas would go in each cell of column C. The result is that column C will contain numbers ranging between 1 and 12, representing to birth months of the people. You can now sort the list based on the contents of column C, with the result that the list is sorted by month.

This approach works fine, but you may not be able to add another column to your worksheet. If this is the case, you can follow these steps to sort by month:

  1. Select the cells in column B (assuming that column B contains the birthdates).
  2. Choose Cells from the Format menu. Excel displays the Format Cells dialog box. (To display the Format Cells dialog box in Excel 2007, it is easiest to press Ctrl+Shift+F.)
  3. Make sure the Number tab is displayed. (Click here to see a related figure.)
  4. In the Category list, choose Custom.
  5. In the Type box, enter four lowercase Ms (mmmm) for the format.
  6. Click on OK. The cells in column B should now show only the birth month of the people in your list. (Don't worry; the underlying birthdates are still there.)
  7. Select your entire list.
  8. Choose Sort from the Data menu. (In Excel 2007, click the Data tab of the ribbon and then click Sort in the Sort & Filter group.) Excel displays the Sort dialog box. (Click here to see a related figure.)
  9. Use the controls in the dialog box to specify that you want to sort by the contents of column B.
  10. Click on the Options button. Excel displays the Sort Options dialog box. (Click here to see a related figure.)
  11. Use the First Key Sort Order drop-down list to specify that you want to sort by months. (Choose the option that states January, February, March, etc.)
  12. Click on OK to close the Sort Options dialog box.
  13. Click on OK to close the Sort dialog box and actually sort the list.

You may be wondering why you need to reformat the display of the cells containing the birthdates (steps 1 through 6). The reason is that when you finally sort your list (steps 7 through 13), if you simply have the original full dates displayed, Excel will effectively sort the list chronologically rather than by month.

There is an additional way you can approach the problem. This involves actually converting the dates into text (instead of the internal serial numbers), as follows:

  1. Select the cells that contain the dates.
  2. Choose Cells from the Format menu or, in Word 2007, press Ctrl+Shift+F. Excel displays the Format Cells dialog box.
  3. Make sure the Number tab is selected.
  4. In the list of Categories, choose Date.
  5. In the list of Types, choose March 14, 1998.
  6. Click on OK. Your cells should now be formatted to show a long date with the month first.
  7. Press Ctrl+C. This copies the cells to the Clipboard.
  8. Open Notepad.
  9. Press Ctrl+V. The information is now pasted into Notepad, and should still be the long dates.
  10. Select the information just pasted into Notepad.
  11. Press Ctrl+C. This copies the information to the Clipboard.
  12. Switch back to Excel.
  13. Choose Cells from the Format menu or, in Word 2007, press Ctrl+Shift+F. Excel displays the Format Cells dialog box.
  14. Make sure the Number tab is selected.
  15. In the list of Categories, choose Text.
  16. Click on OK.
  17. Press Ctrl+V.

Your dates are now pasted into Excel as true text entries, not as dates. This allows you to easily sort the information according to the month in the date.

Tip #3183 applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007


Save Time! ExcelTips has been published weekly since late 1998. Past issues of ExcelTips are available in convenient ExcelTips archives. Have your own enhanced archive of ExcelTips at your fingertips, available to use at any time!
 
Check out ExcelTips Archives today!

Helpful Links

Ask an Excel Question
Make a Comment

Tips.Net Home

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

 

Great Info!

Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your e-mail address and click "Subscribe."
     
(Your e-mail address will never be shared with anyone, ever.)