Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to convert a month name to a month number on the fly

Can someone shed some light on converting a month name to a month number on the fly? (January = 1)

Henry suggested the reverse conversion on a thread from month number to month name: Month(MakeDate(2012,MonthNo))

Thanks,

Xinzhen

1 Solution

Accepted Solutions
sunny_talwar

If MonthName is read as a true date field then simply doing Num(MonthField) should give you the Month Number. If MonthName is read as a text, you can try this:

Num(Month(Date#(MonthName, 'MMMM')))

View solution in original post

2 Replies
sunny_talwar

If MonthName is read as a true date field then simply doing Num(MonthField) should give you the Month Number. If MonthName is read as a text, you can try this:

Num(Month(Date#(MonthName, 'MMMM')))

Not applicable
Author

Thank you Sunny. That worked!

Xinzhen