Skip to main content

Nested IF statements that include ORs

  • January 17, 2022
  • 2 replies
  • 44 views

I need help building a nested IF formula with ORs that implements the following logic: If {Field A} = ValueA OR ValueB then return contents of {Field X}, If {Field A} = ValueC, then return contents of {Field Y}, if {Field A} = ValueD OR ValueE, then return contents of {Field Z}. Thanks!

2 replies

Forum|alt.badge.img+18

Hi @Jenny_Pitman,
Since all of your conditions hinge on the value of one field, I’d suggest using the SWITCH() function. It requires a little bit of repetition of return values, but makes the formula itself much more intelligible when you want to go modify it or add new logic to it later.

SWITCH(
   {Field A},
   ValueA, {Field X},
   ValueB, {Field X},
   ValueC, {Field Y},
   ValueD, {Field Z},
   ValueE, {Field Z}
)

  • Author
  • New Participant
  • January 18, 2022

Hi @Jenny_Pitman,
Since all of your conditions hinge on the value of one field, I’d suggest using the SWITCH() function. It requires a little bit of repetition of return values, but makes the formula itself much more intelligible when you want to go modify it or add new logic to it later.

SWITCH(
   {Field A},
   ValueA, {Field X},
   ValueB, {Field X},
   ValueC, {Field Y},
   ValueD, {Field Z},
   ValueE, {Field Z}
)

Thanks very much, Jeremy. Very helpful! Best regards, Jenny Pitman