Extract month from a date in a cell

excelblob

New Member
Joined
Jan 21, 2010
Messages
10
Well, this shouldn't be that hard but it is for me..

I have a date as 1/1/11 format in a date-formatted cell A1 for example. I want to extract the month in MM format, i.e. January, or "1" is extracted as "01", etc and just place it into A2.

So far, I've found an option to use format function in VBA and "MM", but I'm not familiar with VBA yet.

Of course, left function does not seem to be helping, at least the way I'm using it.

Any ideas? Thanks.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try the MONTH worksheet function to get the month and use the format 00 to get the leading zero.
 
Upvote 0
The month function is easy for me to understand. Thanks. But use format to get 00? Is this a function name I type somewhere? Not quite sure.
 
Upvote 0
In Excel 2007/2010 on the ribbon there's a section called Number.

If you click the tiny arrow in the bottom right of that you'll open up the Format dialog.

Pick Custom from the list on the left and type 00 in the box labelled Type.

Press OK

If it's an earlier version goto Format>Cells... and you'll get the same dialog.

Alternatively you can use this:

=TEXT(MONTH(A1), "00")

Where the date is in A1.
 
Upvote 0
Actually, if you are going to use a formula don't use the one I posted.

It's wrong.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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