Computing.Net > Forums > Office Software > Convert Month to Number

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Convert Month to Number

Reply to Message Icon

Name: Unogwu
Date: October 19, 2009 at 02:37:20 Pacific
OS: Windows 24.08.2009
Subcategory: Microsoft Office
Comment:

Hi,
I have this formula =(mmmm2num($C$4)) for example C4 is Feb, and would like my return to be 2. But this is giving me error #NAME? Is there any easy way out. Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: October 19, 2009 at 04:33:29 Pacific
Reply:

Where did you get mmmm2num from?

Excel is returning #NAME because it does not recognize the function. It is not a built in Excel function so you would need to have a User Defined Function (UDF) stored in a VBA module for it to work.

In any case, try this:

=MONTH(1&C4)


1

Response Number 2
Name: Unogwu
Date: October 19, 2009 at 04:47:42 Pacific
Reply:

Thanks,
Works for me.

Rgd


0

Response Number 3
Name: Humar
Date: October 19, 2009 at 05:05:20 Pacific
Reply:

Hi,

You should also consider whether you want to store months (e.g. Feb in C4) as text.

Without knowing anything about your proposed application it is not possible to decide whether this is the best approach.

If you are using real dates in your application, you can enter a date, such as 01/Feb/2009 in a cell. Excel will recognize it as a date and then you can format the cell with "mmm" and it will show Feb.

Format with "mmmm" and the cell will show February, or
Format with "mm" and it will show 2, - no formula required.

The formula DerbyDad03 gave you works by making Excel think there is a date '1Feb' which it converts to 01 Feb 2009 and then returns the month number (2).
Try =YEAR(1&C4) and you get 2009.

So you may be better off starting with a real date in C4.

Regards


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Convert Month to Number

Convert number of month to name of month www.computing.net/answers/office/convert-number-of-month-to-name-of-month/8636.html

Text to number www.computing.net/answers/office/text-to-number/6294.html

F2 enter in Excel to change the for www.computing.net/answers/office/f2-enter-in-excel-to-change-the-for/1579.html