Help

If (logical) then (text), else run formula?

5227 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Steve_Solari
4 - Data Explorer
4 - Data Explorer

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.

4 Replies 4

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'))

Christoff
7 - App Architect
7 - App Architect

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”)

Steve_Solari
4 - Data Explorer
4 - Data Explorer

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!

Christoff
7 - App Architect
7 - App Architect

In your original post, the space after IF would lead to an error.