2

I am trying to take the name of a month, such as October and turn that into the corresponding number for that month 10. Past making a long formula that checks for each month by string, and without using apps script to create a custom function (not reliable enough).

How would I do this?

1 Answer 1

3

If cell A1 contains the name of the month, then the command

=month(datevalue(A1&" 1"))

returns the number of the month. It appends a day to the month (1), so that datevalue can parse the date; then month returns the month number.

2
  • Nice! Does this work in locales that format dates differently?
    – Jerry101
    Oct 25, 2015 at 4:11
  • Datevalue takes locale and language into account when parsing strings. But I think that October 1 is unambiguous... assuming English language, which is given in the problem. To have completely self contained solution, I would use a helper table and Vlookup function.
    – user79865
    Oct 25, 2015 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.