Converting month name to a number

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,304
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
I have a column of data that includes month names for 1 year which do not appear in the correct order i.e. Jan, Feb, Mar etc.

In an adjacent column I want to have a formula that will give me the month number so that I can sort the column in the correct monthly order.

The reason behind getting the correct order is that I have another column containing some numbers which I want manipulate in code.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I don't think you will need to give them numbers.

Go to Data and Sort then click options on first key sort order, change it to months and this will allow you to sort the months into the correct order
 
Upvote 0
If you want to sort the months into an order not in the normal calendar sequence you could always create a list and then sort
 
Upvote 0
If you go to data sort then click options then click on First key sort order, you should get various choices, one of those being months of the year
 
Upvote 0
The choices I get when I press options are

Sort top to bottom
Sort left to right
 
Upvote 0
The choices I get when I press options are

Sort top to bottom
Sort left to right
If that is so, you are probably using a recent version of Excel. In the Sort dialog, click the 'Order' drop-down and choose 'Custom List..' where a couple of the options should relate to month names. Choose the appropriate one for your data.
 
Upvote 0
OK I tried that, but it still didn't work. If I go to a new tab and enter

MTHNAME
May
April
July
June

it still didn't work?
 
Upvote 0
What version of Excel are you using?

What cells did you typoe this into?
MTHNAME
May
April
July
June
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top