2 August, 2023
While the basic concept of the IF formula is straightforward, creating them can quickly become complex.
In this tutorial, I walk you through my technique for creating these formulas, ensuring that by the end you'll possess the skills to understand and create even the most complex IF formulas.
The is also a video tutorial on YouTube:
For this blog, I'm using a basic sales template which you can duplicate here. In the template is a database with daily records for the entire year. The date is stored in the'Date' property, and each day's sales figures are recorded in the 'Sales' property.
I want to create a new property that will show if I'm hitting my daily sales target and I'll use the IF formula to create it. For this example, my sales target is to have between 5 and 10 sales a day. Anything less than 5 is below target and greater than 10 is above target.
Rather than immediately diving into creating the IF formula, it's helpful to build it incrementally. If you start writing the IF formula out in full, straight away it's often difficult to work out where any problems are.
prop("Sales") > 10
Notion has two options for writing IF statements, I prefer to use this one as I find it more user-friendly and scalable.
To illustrate this, let's expand the formula further:
prop("Sales") > 10 ? "Above Target" : ""
The final stage is to complete the formula:
prop("Sales") > 10 ? "Above Target" :prop("Sales") < 5 ? "Below Target" : "On Target"
To enhance the property's readability, I want to now put icons instead of text into the target property's value:
(prop("Sales") > 10) ? "🟢" : ((prop("Sales") < 5) ? "🔴" : "🟡")
tip: to get the icon menu to appear in the formula. For windows hold the Windows logo key + . (period). For Mac Press Control-Command-Space
Congratulations! You've successfully written your first IF statement in Notion. Remember, it's best to construct these formulas in stages, testing each step's functionality, rather than attempting to create the entire formula in one go. This method ensures that any errors can be located and resolved more efficiently.
Part 2 of this blog will show you how to write longer IF formulas...coming soon!
Manage all your invoices in Notion, then generate and track PDF invoices using Pop Invoice.Try Pop Invoice