Month: Word to Number

Sarah K

New Member
Joined
Nov 26, 2008
Messages
24
Is there a formula in Excel VB that will allow me to convert a month's name to its numberic equivalent?

So for example:
October to 10
June to 6 etc...


I know I can do a lookup or something, but it there anything slicker?
Any help would be great
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Whooaaa.
How come that workedd??

If A1 = October
then
A1&"1" = October1
but that's just a text string right??

The month function extracts the month # from a given date.
And it does the best it can to convert text strings into Dates.
In this case, October1 is converted to October 1st 2011(current year)

it will even work with abbreviated months...
Oct, Nov, Dec, Jan etc..
 
Upvote 0
If A1 = October
then
A1&"1" = October1
but that's just a text string right??

The month function extracts the month # from a given date.
And it does the best it can to convert text strings into Dates.
In this case, October1 is converted to October 1st 2011(current year)

That's such a neat trick :D
Thank you for the explanation!

Kpark.
 
Upvote 0
Thank's for your quick reply.

I am looking for something that works as code in Microsoft Visual basic, not in the cell of the excel worksheet, any thoughts?
 
Upvote 0
You can do it almost exactly the same in VBA...
You just have to put a space between October and 1

Try
x = Month(Range("A1") & " 1")
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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