Help

Nested 3 IF() statements with 3 AND()

Solved
Jump to Solution
1039 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Julien_Reszka
5 - Automation Enthusiast
5 - Automation Enthusiast

What is wrong with my nested if? It says that that It’s invalid

IF(
  AND(
    {5dayswithnochange},
    {issueStatus🟢or🔴or🟠}=🟢
  ), 
  "Stable ⚖", 
  IF(
    AND(
      {5dayswithnochange}, 
      {issueStatus🟢or🔴or🟠}=🟠
    ), 
    "Stuck 🆘", 
    IF(
      AND(
        {5dayswithnochange},
        {issueStatus🟢or🔴or🟠}=🔴
      ), 
      "Broken 🔥", 
      "Too soon to tell ❔"
    )
  )
)
1 Solution

Accepted Solutions
Julien_Reszka
5 - Automation Enthusiast
5 - Automation Enthusiast

nevermind, I forgot to add the quotes “” around the emojis :green_circle: in the equality evaluations
Correct code

IF(
  AND(
    {5dayswithnochange},
    {issueStatus🟢or🔴or🟠}="🟢"
  ), 
  "Stable ⚖", 
  IF(
    AND(
      {5dayswithnochange}, 
      {issueStatus🟢or🔴or🟠}="🟠"
    ), 
    "Stuck 🆘", 
    IF(
      AND(
        {5dayswithnochange},
        {issueStatus🟢or🔴or🟠}="🔴"
      ), 
      "Broken 🔥", 
      "Too soon to tell ❔"
    )
  )
)

See Solution in Thread

3 Replies 3
Julien_Reszka
5 - Automation Enthusiast
5 - Automation Enthusiast

nevermind, I forgot to add the quotes “” around the emojis :green_circle: in the equality evaluations
Correct code

IF(
  AND(
    {5dayswithnochange},
    {issueStatus🟢or🔴or🟠}="🟢"
  ), 
  "Stable ⚖", 
  IF(
    AND(
      {5dayswithnochange}, 
      {issueStatus🟢or🔴or🟠}="🟠"
    ), 
    "Stuck 🆘", 
    IF(
      AND(
        {5dayswithnochange},
        {issueStatus🟢or🔴or🟠}="🔴"
      ), 
      "Broken 🔥", 
      "Too soon to tell ❔"
    )
  )
)

Glad you were able to fix your issue yourself!

However, I happened to see your formula and thought you might be interested in a slightly simpler version. This version has less nesting and eliminates the need for the AND functions. It also uses the SWITCH function, which is really useful for when dealing with multiple possible values for a single field.

IF ({5dayswithnochange},
    SWITCH({issueStatus🟢or🔴or🟠},
      "🟢", "Stable ⚖", 
      "🟠", "Stuck 🆘", 
      "🔴", "Broken 🔥"
    ),
    "Too soon to tell ❔"
)

Tank you! simpler syntax indeed.