• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

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)))))))
0
jjxia2001
Asked:
jjxia2001
  • 3
2 Solutions
 
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)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
 
barry houdiniCommented:
If you have just the month as text then this should do it

=MONTH(1&$C21)

regards, barry
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now