ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Converting month name to number (https://www.excelbanter.com/excel-worksheet-functions/157175-converting-month-name-number.html)

Mats Samson

Converting month name to number
 
How do I transfer the month name February in a cell to its corresponding
number 2, March to 3, etc, so I can use it in a formula in another cell?

Ron Coderre

Converting month name to number
 
With
A1: (a month name....eg March)

Try this
=MONTH("01-"&A17)

In my example the formula returns: 3


Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

"Mats Samson" wrote in message
...
How do I transfer the month name February in a cell to its corresponding
number 2, March to 3, etc, so I can use it in a formula in another cell?




Ron Coderre

Converting month name to number
 
In case it isn't obvious....

My formula should reference A1, instead of cell A17

=MONTH("01-"&A1)

Regards,

Ron
Microsoft MVP (Excel)

"Ron Coderre" wrote in message
...
With
A1: (a month name....eg March)

Try this
=MONTH("01-"&A17)

In my example the formula returns: 3


Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

"Mats Samson" wrote in message
...
How do I transfer the month name February in a cell to its corresponding
number 2, March to 3, etc, so I can use it in a formula in another cell?






Mats Samson

Converting month name to number
 


"Ron Coderre" wrote:

With
A1: (a month name....eg March)

Try this
=MONTH("01-"&A17)


Sorry Ron but I can't get that to work. A17 must be an error, right?

In my example the formula returns: 3


Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

"Mats Samson" wrote in message
...
How do I transfer the month name February in a cell to its corresponding
number 2, March to 3, etc, so I can use it in a formula in another cell?





Sandy Mann

Converting month name to number
 
Just another way:

=MONTH(A1&0)

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Mats Samson" wrote in message
...
How do I transfer the month name February in a cell to its corresponding
number 2, March to 3, etc, so I can use it in a formula in another cell?




Rick Rothstein \(MVP - VB\)

Converting month name to number
 
A1: (a month name....eg March)

Try this
=MONTH("01-"&A1)

In my example the formula returns: 3


Looks like you can shorten your formula a tad more; this seems to work...

=MONTH("1"&A4)

Rick

Mats Samson

Converting month name to number
 


"Ron Coderre" wrote:

With
A1: (a month name....eg March)

Try this
=MONTH("01-"&A17)


Thanks Ron, it worked now.
I had the cell Date formatted, it should be General!
Simple and swift, nice!
Best regards
Mats

In my example the formula returns: 3


Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)

"Mats Samson" wrote in message
...
How do I transfer the month name February in a cell to its corresponding
number 2, March to 3, etc, so I can use it in a formula in another cell?





Rick Rothstein \(MVP - VB\)

Converting month name to number
 
A1: (a month name....eg March)

Try this
=MONTH("01-"&A1)

In my example the formula returns: 3


Looks like you can shorten your formula a tad more; this seems to work...

=MONTH("1"&A4)


Actually, the quote marks are not needed...

=MONTH(1&A4)

Rick

Ron Coderre

Converting month name to number
 
You're right....by fussing with a character here and there the formula can
be shortened. However, for something this basic, I went with a fairly
intuitive, non-ambiguous, easily remembered date format that Excel would
properly translate (eg "01-March").

Regards,

Ron
Microsoft MVP (Excel)


"Rick Rothstein (MVP - VB)" wrote in
message ...
A1: (a month name....eg March)

Try this
=MONTH("01-"&A1)

In my example the formula returns: 3


Looks like you can shorten your formula a tad more; this seems to work...

=MONTH("1"&A4)

Rick





All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com