When you are creating formulas in your Revit Families, there
is a hierarchy to be followed. As Revit works its way along the formula,
especially when you are using nested if statements with multiple conditions,
these must be written before any statements with single conditions. Revit works
along the lines of the first correct statement will take precedence.
In the example below I have created 2 formulas, they are
both the same except they are written in 2 different directions. All statements
are correct but the result is determined by the formula hierarchy.
The ‘RESULT 1’ formulas is…..
If A=100 and B=200 and C=300 then the result is 1.0
And if A=100 and B=200 then the result will be 2.0
And if A=100 then the result will be 3.0
And if neither of these statements is correct then the
result will be 0
When this is written in the formula because the first
multiple statement is correct then the result will be 1.0 even though all of
the statements are technically correct, Revit has to pick one result so it
takes the first one.
The ‘RESULT 2’ formula is…..
If A=100 then the result will be 3.0
And if A=100 and B=200 then the result will be 2.0
And if A=100 and B=200 and C=300 then the result is 1.0
And if neither of these statements is correct then the
result will be 0
When this is written in the formula because the first single
statement A=100 is correct then this takes precedence and the final result is
3.0. Again all of the statements are technically correct so it picks the first
one in the formula.
The ‘rule of thumb’ is to write your statements with
multiple conditions at the beginning of the formula and leave your single
statements until the end.