Building Calculations With Nested IF Statements

When creating calculations using nested IF statements, it is important to recognize that no matter how complex they look, they can always be broken down into single IF statements.

The syntax for an IF statement in FileMaker Pro is:
If (test, result one, result two)

It might be easier to think of an IF statement as a yes/no question that determines the next action taken:
If (question, do this if the answer is yes, do this if the answer is no)

The trick is to phrase the test so there is only a true or false (yes or no) answer possible, for example:
If (2+3=5, "true", "false")

FileMaker first calculates "2+3=5", then processes the appropriate result, which is to display "true."


The simplest way to describe a nested IF statement is to think of an IF statement inside of an IF statement, or in other words, a series of yes/no questions designed to lead to a desired result.

In a nested IF calculation, the test part is evaluated first. Based on the result of the test (usually a false result), the next IF statement or test is evaluated. The desired result is achieved through the process of elimination from previous IF statements in the calculation.

Let's say that result two (the result you get when the test is false) is replaced by another IF statement to be processed. In this case, result two = If (test, result one, result two). Below is what the expanded IF statement looks like:
If(test, result one, If (test, result one, result two))

In English, this would read: "IF the first test is true, process result one, or else process result two, which happens to be another IF statement."