| View previous topic :: View next topic |
| Author |
Message |
seancm General User

Joined: 26 Sep 2006 Posts: 7
|
Posted: Tue Oct 03, 2006 9:10 am Post subject: Changing Month (Text form) to Month (Number form) |
|
|
Is there a way to take a month in it's text form (ie. "January", "March", etc...) and get its number form from it (ie. 1, 3, etc...)?
I have tried various things (of course I have no idea what I am doing but have tried anyway) but have not been able to find a way to do it.
Some things I have tried:
MONTH(DATE(2006;March;1))
MONTH(March)
And a few other that I can no longer remember.
Thanks in advance.
Sean |
|
| Back to top |
|
 |
acknak Moderator


Joined: 13 Aug 2004 Posts: 4295 Location: ~ 40°N,75°W
|
Posted: Tue Oct 03, 2006 9:58 am Post subject: |
|
|
| Code: | | =MONTH(DATEVALUE("jan 1")) | Works, but | Code: | | =MONTH(DATEVALUE("jan")) | doesn't. You need at least a day number to get a valid date. If you can take the month name from another cell and stick on an arbitrary day number, it should work. Like so: | Code: | | =MONTH(DATEVALUE(A1&" 1")) | .
You can also set up a table of (Month_Name, Month_Number) and use VLOOKUP. |
|
| Back to top |
|
 |
seancm General User

Joined: 26 Sep 2006 Posts: 7
|
Posted: Tue Oct 03, 2006 10:16 am Post subject: |
|
|
Thanks that worked great.
Sean |
|
| Back to top |
|
 |
carl Super User


Joined: 21 Apr 2003 Posts: 920 Location: Germany
|
Posted: Tue Oct 03, 2006 11:20 pm Post subject: |
|
|
you could enter the month as a date ie 01.01.06
and then FORMAT it as any of the date formats (including "January") _________________ carl
Using OpenOffice.org 2 on XP sp2 |
|
| Back to top |
|
 |
|