This is your sign to try out if() and ifs()
The if and ifs functions are among the most useful and versatile formulas in Notion. This tutorial will explain what these functions do, how to use them, and provide some practical examples. Let's get started!
For this guide, I referenced the Notion Formula documentation and added my own examples and explanations.
Summary
Name | Syntax | How it works | Example |
if | if(condition, ifTrue, ifFalse) | Returns the first value if the condition is true; otherwise, returns the second value. | if(true, 1, 2) → 1
if(false, 1, 2) → 2 |
ifs | ifs(condition, ifTrue, condition2, ifTrue2, ..., else) | Returns the value that corresponds to the first true condition. This can be used as an alternative to multiple nested if() statements. | ifs(true, 1, true, 2, 3) → 1
ifs(false, 1, false, 2, 3) → 3 |
if() Formula
How if() works
The if() function is used to return values based on whether the multiple conditions are true or false.
Here's how you would write the if statement in Notion:
if(condition, ifTrue, ifFalse)
Notion Formula
복사
Breaking it down
condition: The condition is a special kind of statement that must be either true or false.
•
ifTrue: The value to return if the condition is true.
•
ifFalse: The value to return if the condition is false.
Example of if
formula
Search
ifs Formula
How ifs works
The ifs function is used to return different values based on whether multiple conditions are true or false.
Here's how you would write the ifs statement in Notion:
ifs(condition, ifTrue, condition2, ifTrue2, ..., else)
Notion Formula
복사
# Before with if()
if(condition1,
ifTrue,
if(
condition2,
ifTrue2,
ifFalse2
)
)
Notion Formula
복사
# After with ifs()
ifs(
condition1,
ifTrue,
condition2,
ifTrue2,
...,
ifFalse
)
Notion Formula
복사
Breaking it down
Just as if() is singular and ifs() is plural, you can think of an ifs() statement as an if() statement with multiple conditions. Each condition can yield a different value, depending on whether it's true or false. It's a convenient alternative to using multiple nested if() statements.
•
condition1, 2,…: The condition is a special kind of statement that must be either true or false.
◦
Note that if both condition 1 and condition 2 are true, the value of the preceding condition that appears first will be returned.
•
ifTrue1, ifTrue2,…: The value to return if the corresponding condition (e.g., condition 1, ifTrue 1) is true.
•
ifFalse: The value to return if all conditions is false.
Example of ifs
formula
Search
Conclusion
Thank you for reading this tutorial! If you found it helpful, be sure to check out shop for my beautiful templates, which I am confident enough to say are a game-changer Subscribe to my newsletter and feel free to follow me on my social media for updates!
Happy Notion(ing)!
links
Search