Red Gregory

View Original

How To Write Nested IF Statements In Notion

The result we want in plain english →

  • if tag equals Work :: Checked

  • if due within 2 weeks :: Checked

  • if hours allotted greater than 2 hours :: Checked

  • Otherwise :: Unchecked

The result in a nested IF Statement →

if(if(if(prop("Tags") == "Work", true, false), dateBetween(prop("Due"), prop("Today"), "days") <= 14, true), prop("Hours Allotted") > 2, true)

Break Down →

Essentially, we're going to work from the middle out:

  • if tag equals Work :: Checked → if(prop("Tags") == "Work", true, false)

  • if due within 2 weeks :: Checked → if(if(prop("Tags") == "Work", true, false), dateBetween(prop("Due"), prop("Today"), "days") <= 14, true)

  • if hours allotted greater than 2 hours :: Checked → if(if(if(prop("Tags") == "Work", true, false), dateBetween(prop("Due"), prop("Today"), "days") <= 14, true), prop("Hours Allotted") > 2, true)

Syntax Reference →

  1. FALSE: if(true, false, true)

  2. FALSE: if(if(true, false, true), true, false)

  3. TRUE: if(if(if(true, false, true), true, false), false, true)

  4. TRUE: if(if(if(if(true, false, true), true, false), false, true), true, false)

VIEW EXAMPLE