Jun 08, 2017 05:09 PM
Having trouble nesting my formulae. Let’s say I want to figure out something to the effect of:
IF ({Summer Camp Participant}="Minor",'N/A', ELSE [do math to calculate age])
I don’t need help with the math formula, I just need to get the syntax correct for "if the first argument fails, then run this formula instead of print this value. Hope that makes sense.
I understand the normal route – IF ARGUMENT IS TRUE,VALUE,ELSE OTHER VALUE. But in this case I’m not after an ELSE OTHER VALUE but an ELSE RUN FORMULA to get a different value.
Jun 09, 2017 08:49 AM
If I understand you correctly, you simply replace the appropriate IF branch with the desired function – essentially, the syntax of your example minus the word ‘THEN’.
For instance, something like this
IF({Summer Camp Participant}="Minor", 'N/A', DATETIME_DIFF({Birth Date},TODAY(),'Y'))
Jun 09, 2017 09:30 AM
As W_Vann_Hall points out, the “ELSE” portion can be a function.
It can even be another IF() .
One small tip: If there’s the possibility that the Birth Date could be blank, then test for the existence of the date to avoid displaying #ERROR! in the table. Use something like IF({Birth Date},[age calculation formula],“N/A”)
Jun 09, 2017 09:45 AM
Thanks @Christoff and @W_Vann_Hall. I thought it is as you say, but I kept getting error messages when I tried that route. Now that I know it IS a valid syntax, I’ll keep debugging. Appreciate it!
Jun 09, 2017 10:23 AM
In your original post, the space after IF would lead to an error.