Skip to main content
Solved

Logic of Nested IF statements

  • January 28, 2020
  • 2 replies
  • 43 views

I have fields named Tasks, Due Date, Task Completed and Status. Using a guide from another post I came up with:
IF({Task Completed?}=1,“Done”, IF(IS_BEFORE({Due Date}, TODAY()), “Overdue”, “In Progress”)).

This works fine. But, I would like to somehow have it so if the task field is Empty, it returns “No Task”. How would I add that to the above formula without confounding what is already going on? It’s like a third ELSE statement, or am I thinking completely backwards on this?

Best answer by Jason11

Hi @Oswego_County_Monume! You need one more IF statement wrapped around you current formula, in a structure like this:

IF(
   {Task Completed?},
      RUN CURRENT FORMULA,
      "No Task"
)

 

This completed formula should do the trick:

IF(
   {Task Completed?},
   IF(
      {Task Completed?}=1,
         "Done", 
   IF(
      IS_BEFORE({Due Date}, NOW()), 
         "Overdue", 
         "In Progress"
   )
   ),
      "No Task"
)

2 replies

Forum|alt.badge.img+20
  • Inspiring
  • Answer
  • January 28, 2020

Hi @Oswego_County_Monume! You need one more IF statement wrapped around you current formula, in a structure like this:

IF(
   {Task Completed?},
      RUN CURRENT FORMULA,
      "No Task"
)

 

This completed formula should do the trick:

IF(
   {Task Completed?},
   IF(
      {Task Completed?}=1,
         "Done", 
   IF(
      IS_BEFORE({Due Date}, NOW()), 
         "Overdue", 
         "In Progress"
   )
   ),
      "No Task"
)

  • Author
  • New Participant
  • January 29, 2020

Thank you! That did the trick. I will figure out later exactly how that works so I can apply to future formula fields, but for now this will do it. Thanks!