Auditable

Deeply nested IF

An IF nested three or more levels deep multiplies the paths a reader has to follow, and that is where logic errors hide.

What MaxCheck detects

IF nested 3 or more levels deep anywhere in the formula. ELSE IF links don't add depth: a flat IF / ELSE IF / ELSE IF chain is depth 1 (long chains are L_LONGELSEIFCHAIN).

Why it hurts

Each level multiplies the paths a reader has to follow. Deep IFs are where logic errors hide.

Example

Taken from the rule's own test cases: formulas it must flag, and formulas it must not.

WarningFlags this(formula starting with a paren)

(IF A THEN IF B THEN IF C THEN 1 ELSE 2 ELSE 3 ELSE 4)

Fine (ISNOTBLANK fallback chain)

IF ISNOTBLANK(First) THEN First ELSE IF ISNOTBLANK(Second) THEN Second ELSE IF ISNOTBLANK(Third) THEN Third ELSE Fallback

How to fix

Move the inner decisions into their own line items, or replace a long ELSE IF chain with a mapping list and LOOKUP.

Severity
WarningCounts toward the area score.
Area
Auditable
Runs in
Basic and full check
Rule ID
A_LONGNESTED
Version
Rule 2.0.0, rule set 1.4.0
Planual
2.02-01 Nested IFson Anaplan's Formulas page

Does your model do this?

Upload the line-items blueprint. This rule runs in the basic check, in your browser, with no email.

Check your model