how to write more than 7 IF statements within a formula

I got an error message when I reach August.  I heard the limitation is 7 IF statements within one formula.  Is there any other way I can include all 12 months in one formula?

IF(TRIM($C21)="January",1,IF(TRIM($C21)="February",2,IF(TRIM($C21)="March",3,IF(TRIM($C21)="April",4,IF(TRIM($C21)="May",5,IF(TRIM($C21)="June",6,IF(TRIM($C21)="July",7,0)))))))
jjxia2001Asked:
Who is Participating?
 
barry houdiniConnect With a Mentor Commented:
If you have just the month as text then this should do it

=MONTH(1&$C21)

regards, barry
0
 
zorvek (Kevin Jones)ConsultantCommented:
Use this formula:

=MATCH($C21,{"January","February","March","April","May","June","July","August","September","October","November","December"},0)

Kevin
0
 
zorvek (Kevin Jones)Connect With a Mentor ConsultantCommented:
Or this one:

=MONTH(VALUE("1 "&$C21))

Kevin
0
 
zorvek (Kevin Jones)ConsultantCommented:
You can't have more than seven nested functions which is what you are encountering with the IF function formula.

Kevin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.