Formulas can be highly counterintuitive if you don't have a background in some kind of code-based discipline.
Here's a couple of key concepts that are in play here.
A function in a formula always looks like this:
FUNCTION_NAME(list, of, parameters)
The parameters can be literals (values you write out, like 2.0
), merge fields, expressions like Amount * 0.5
, or other functions to evaluate. They're always separated by commas.
Different functions require specific sets of parameters. IF()
takes 3: a comparison, a value to use when it's true, and a value to use when it's false.
Functions within functions always nest cleanly with matched parentheses:
FUNCTION_ONE(2.0, Id, FUNCTION_TWO(ParentId)
meaning that the outermost function closes last, and fully encloses all of its parameters in its parentheses. Inner function expressions must nest similarly, always with a balanced set of parentheses around the parameters for a single function.
Here, what you need to do is nest your IF()
statements so that when the outer one's first parameter is false, its value (the third parameter) is the result of another IF()
function - which must itself have 3 parameters (condition, when true value, when false value).
That should be enough to express your objective. See if you can stitch the values you're working with into that structure, and make use of the formula editor's Check Syntax button. It will tell you when something's wrong at the code level, as opposed to the behavior level.
Resources