I need to have multiple IF statements along with "OR". I am not getting the results I wanted. Here is what I have:
State
Western NC
Eastern NC
Central NC
West FL
South FL
I want to use to say "IF [State] = "Western NC" OR "Eastern NC" OR "Central NC"
THEN "NC"
ELSEIF [State] = "West FL" OR "South FL"
THEN "FL"
ELSE [State]
END IF
I am only getting the first value of each IF statement. Can anyone help?
Thanks!
Solved! Go to Solution.
Hi @BrandonS4,
You're close, just needs a couple of tweaks.
IF ([State] = "Western NC" OR [State] = "Eastern NC" OR [State] = "Central NC")
THEN "NC"
ELSEIF ([State] = "West FL" OR [State] = "South FL")
THEN "FL"
ELSE [State]
ENDIF
If this solves your issue please mark the answer as correct, if not let me know!
Regards,
Jonathan
Hi @BrandonS4,
But i would also prefer to clean the statement up a little and use the IN() function rather than repeating the column name each time:
IF [State] IN("Western NC","Eastern NC","Central NC")
THEN "NC"
ELSEIF [State] IN("West FL","South FL")
THEN "FL"
ELSE [State]
ENDIF
If this solves your issue please mark the answer as correct, if not let me know!
Regards,
Jonathan
This is what I was looking for. Thank you for the quick reply!
One other question. I currently have this report outputting to 5 sheets...Western NC, Eastern NC, Central NC, West FL and South FL. How can I add a sheet for NC and FL?
Hi @BrandonS4, could you provide us a sample of your data for us to look at? It sounds like you need to summarize your data at State level, in addition to Region. You can write a formula (name it State) and summarize your data at state level, and output it the way you output your regions.
I was able to figure this out. I just created two different file names in two different formula tools then joined them and it worked.