 # Error in if-statement expression

How to make the following expression a logical/valid one

Rows 240 and 242 if the attached xls form is where the calculations occur
screening.xlsx (82.8 KB)

Hi @scherrie,

I see a small typo error in `line number 242`:

`if(\${total_screening_score}='4', 'eligible, 'not eligible')`

Would you mind replacing it with:

`if(\${total_screening_score}='4', 'eligible', 'not eligible')`

Your desired expression should work.

Have a great day!

thanks Kal. I copied and pasted your response, as I was trying to see the small typo. Nevertheless it worked.

I am trying to write an if-statement to reflect the following:

Final score 0-15 - \$500
Final score 16-30 - \$750
Final score 31-40 - 1000

can you tell me where I have went wrong in this if-statement?

if(((\${final_score}<=15), ‘500’, if(((\${final_score}<15 and \${final_score}<=30), ‘750’, if((\${final_score}>30 and \${final_score}<=40), ‘1000’, 0)))

1 Like

Hi @scherrie,

Try this out (it should work):

`if((\${final_score} <= 15), '\$500', if((\${final_score} >= 16 and \${final_score} <= 30), '\$750', if((\${final_score} >= 31 and \${final_score} <= 40), '\$1000', '')))`

or

`if((\${final_score} <= 15), '\$500', if((\${final_score} >= 16 and \${final_score} <= 30), '\$750', if((\${final_score} >= 31 and \${final_score} <= 40), '\$1000', '0')))`

Note: Here the first workaround displays nothing if a final score is entered outside a range while the second workaround displays `0’ for the same.

Have a great day!

thanks it worked. Still figuring out the brackets why sometimes my expressions do not work

1 Like

Whenever you think of brackets you should always remember that even with calculations, the BODMAS rule applies i.e. the order of computing things always follows Brackets, Of, Division, Multiplication, Addition, and Subtraction. With that in mind, if you do not close out a bracket appropriately, the bracket will not be affected as needed causing lots of errors.

Stephane

1 Like