In this tutorial I'm going to explain how nested IF statements are written inside Notion formulas. You may need a preliminary understanding of Notion formulas before understanding alternate syntaxes but I'll try my best to explain everything from the ground up. Elements I'll be using: Number, Multi-Select, Title, Date and Formula properties.
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)
Nested IF Statements
Syntax Reference →
- FALSE:
if(true, false, true)
- FALSE:
if(if(true, false, true), true, false)
- TRUE:
if(if(if(true, false, true), true, false), false, true)
- TRUE:
if(if(if(if(true, false, true), true, false), false, true), true, false)