You are viewing limited content. For full access, please sign in.

Question

Question

Forms Calculation - Using the Find function for an IF evaluation

asked on July 27, 2021 Show version history

How can I use the FIND function in an IF Statement?

FIND returns a number if it finds something, but if it does not find something it does not return a number.

So I can't simply say IF(FIND(...)>0,A,B)

Already tried LEN, it does not return 0 if FIND does not return anything either.

0 0

Replies

replied on July 28, 2021

You might be way past this by now, but this worked for me:

 

=IF(INDEX(variable, ROW()) = "TEXT1OPTION", MULT(INDEX(variable, ROW()), OUTCOMEVARIABLE1), IF(INDEX(variable, ROW()) = "TEXT2OPTION", MULT(INDEX(variable, ROW()), OUTCOMEVARIABLE1),IF(INDEX(variable, ROW()) = "TEXT3OPTION", MULT(INDEX(variable, ROW()), OUTCOMEVARIABLE1), IFNOTOUTCOMEISFOUND)))

0 0
replied on July 28, 2021

Hi Rose! The problem is since FIND returns null, any attempt to evaluate with a null in the IF statement will throw a syntax error.

IF(NULL>0,A,B) will throw a syntax error rather than choosing B as a value.

0 0
replied on July 28, 2021

I usually will then just set the default value to 0 and then you don't have to worry about null values

0 0
replied on July 28, 2021

I suppose they could have another hidden field with a default value of 0 that only runs the FIND function. Then they could have another field which runs an IF function on the value of the field hooked up to the FIND function.

0 0
replied on July 28, 2021 Show version history

Yup :)  or you can just use JQuery/JavaScript

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.