Nested If statements in formula

Viewing 2 reply threads
  • Author
  • October 25, 2019 at 1:37 PM #37383

    Mackay Steffensen

    Is it possible to test multiple conditions and return a value based on the result. In Excel this can be done with nested IF statements (among others). Is something like this possible in Tapforms? For example: If(Field;”Spring”;”10″) or If(Field;”Summer”;”20″) or If(Field;”Fall”;”30″)

    October 25, 2019 at 4:39 PM #37390


    Hi Mackay,

    Yes, you can do this in a Tap Forms formula. But it’s much easier to deal with in a Script field rather than a Calculation field.

    Your example though doesn’t quite make sense because there’s no condition in the first parameter.

    You need to compare Field with something.

    For example:

    IF(Field = 10; "Spring"; IF(Field = 20; "Summer"; IF(Field = 30; "Fall"; "")))

    So if field is 10, return Spring, otherwise if field is 20, return Summer, otherwise if field is 30, return Fall, otherwise return the empty string.

    But in a Script, it would look like this:

    if (field == 10) {
       return "Spring";
    } else if (field == 20) {
       return "Summer";
    } else if (field == 30) {
       return "Fall";
    } else {
       return ""

    To me that’s just easier to read than the nested IF() function.

    You can also use a switch statement, which might look nicer.



    October 26, 2019 at 8:21 AM #37409

    john cesta

    Here’s a simple example I use to test pay codes


Viewing 2 reply threads

You must be logged in to reply to this topic.