Program Functions

How To Write Nested IF Statements In Notion

Screen Shot 2020-03-02 at 3.59.50 PM.png

๐ŸŽณ Nest IF Statement

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)

notion_nested_if_statements.png

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