ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Function or formula to convert "text" month to number of month? (https://www.excelbanter.com/excel-discussion-misc-queries/69559-function-formula-convert-text-month-number-month.html)

Steve Vincent

Function or formula to convert "text" month to number of month?
 
Is there a function to convert the text name of a month (e.g., "April") to
its corresponding number (e.g., "4")? If not, the only workaround I can
think of would be a long, nested IF function (e.g., =IF(A1="January",
"1",IF(A1="February", "2", . . . etc. . . ))))))))

TIA for any help offered,
Steve

Kevin Vaughn

Function or formula to convert "text" month to number of month
 
You're welcome.
--
Kevin Vaughn


"Steve Vincent" wrote:

Perfect! Thanks Kevin!
Steve

"Kevin Vaughn" wrote:

With April in B18, this worked for me:
=MONTH(DATEVALUE(B18 & " 1, 2006"))
--
Kevin Vaughn


"Steve Vincent" wrote:

Is there a function to convert the text name of a month (e.g., "April") to
its corresponding number (e.g., "4")? If not, the only workaround I can
think of would be a long, nested IF function (e.g., =IF(A1="January",
"1",IF(A1="February", "2", . . . etc. . . ))))))))

TIA for any help offered,
Steve


Jennnifer

Function or formula to convert "text" month to number of month?
 
Does anoyone know how to do the reverse. Convert month number to text.

Ex: 1 = Jan, 2= Feb

"Steve Vincent" wrote:

Is there a function to convert the text name of a month (e.g., "April") to
its corresponding number (e.g., "4")? If not, the only workaround I can
think of would be a long, nested IF function (e.g., =IF(A1="January",
"1",IF(A1="February", "2", . . . etc. . . ))))))))

TIA for any help offered,
Steve


Peo Sjoblom

Function or formula to convert "text" month to number of month?
 
There is no built in conversion either way but it is easy to make one

=VLOOKUP(A1,{1,"Jan";2,"Feb";3,"Mar";4,"Apr";5,"Ma y";6,"Jun";7,"Jul";8,"Aug";9,"Sep";10,"Oct";11,"No v";12,"Dec"},2,0)


with your number in A1

You might want to wrap it in an IF function in case a1 is blank

=IF(A1="","",VLOOKUP(A1,{1,"Jan";2,"Feb";3,"Mar";4 ,"Apr";5,"May";6,"Jun";7,"Jul";8,"Aug";9,"Sep";10, "Oct";11,"Nov";12,"Dec"},2,0))



--
Regards,

Peo Sjoblom



"Jennnifer" wrote in message
...
Does anoyone know how to do the reverse. Convert month number to text.

Ex: 1 = Jan, 2= Feb

"Steve Vincent" wrote:

Is there a function to convert the text name of a month (e.g., "April")
to
its corresponding number (e.g., "4")? If not, the only workaround I can
think of would be a long, nested IF function (e.g., =IF(A1="January",
"1",IF(A1="February", "2", . . . etc. . . ))))))))

TIA for any help offered,
Steve




Dave Peterson

Function or formula to convert "text" month to number of month?
 
=text(date(2007,a1,1),"mmm")

if A1 contained the number (1-12).

Jennnifer wrote:

Does anoyone know how to do the reverse. Convert month number to text.

Ex: 1 = Jan, 2= Feb

"Steve Vincent" wrote:

Is there a function to convert the text name of a month (e.g., "April") to
its corresponding number (e.g., "4")? If not, the only workaround I can
think of would be a long, nested IF function (e.g., =IF(A1="January",
"1",IF(A1="February", "2", . . . etc. . . ))))))))

TIA for any help offered,
Steve


--

Dave Peterson

Jennnifer

Function or formula to convert "text" month to number of month
 
Thanks Dave!

"Dave Peterson" wrote:

=text(date(2007,a1,1),"mmm")

if A1 contained the number (1-12).

Jennnifer wrote:

Does anoyone know how to do the reverse. Convert month number to text.

Ex: 1 = Jan, 2= Feb

"Steve Vincent" wrote:

Is there a function to convert the text name of a month (e.g., "April") to
its corresponding number (e.g., "4")? If not, the only workaround I can
think of would be a long, nested IF function (e.g., =IF(A1="January",
"1",IF(A1="February", "2", . . . etc. . . ))))))))

TIA for any help offered,
Steve


--

Dave Peterson



All times are GMT +1. The time now is 07:19 AM.

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