Table of contents
Notion’s ‘Number’ property type is easy to deal with — you can implement basic math functions like addition, count, average, etc., without breaking a sweat.
However, other Notion database property types, like ‘Checkbox,’ are not as straightforward when it comes to functions such as count. That’s because, unlike Google Sheets, there’s no ‘count()’ function or its variations to simplify the math function. So we need to use the ‘Formula’ property type to find a workaround.
We’ll demonstrate the process of counting the number of completed checkboxes in a Notion database using the example of a workout tracker that records which muscle groups were trained on different days of the week.
TL;DR
1. Create a Notion database with multiple ‘Checkbox’ columns
2. Create a ‘Formula’ property-type column
3. Use the Notion property to count completed checkboxes
4. Calculate the percentage of checkboxes marked complete
Let’s get started.
1. Create a Notion database with multiple ‘Checkbox’ columns
If you do not already have a ready-to-experiment database, create one with multiple ‘Checkbox’ property type columns.
Here’s what our sample database looks like:
2. Create a ‘Formula’ property-type column
Here’s where we will add the formula to count the number of checked boxes in the row.
3. Use the Notion property to count completed checkboxes
Access the window where you can add the formula by clicking the ‘Edit formula’ drop down.
Paste this formula in the newly opened window and click the ‘Save’ button.
if(prop("Column Name"), 1, 0) + if(prop("Column Name"), 1, 0) + ... (for all columns you want to include)
Here’s how Notion interprets this formula:
if(condition, true_value, false_value):
This is the conditional function in Notion.
- condition: Represents the checkbox property for a specific column (e.g., prop("Monday")).
- true_value: The value to return if the checkbox is checked (true). Here, we use 1.
- false_value: The value to return if the checkbox is unchecked (false). Here, we use 0.
prop("Column Name"):
- prop() accesses the value of the property/column named inside the quotes. For example, prop("Monday") gets the value of the checkbox in the Monday column.
Summing with +:
- Each if statement evaluates whether a checkbox is checked (1) or not (0).
- The + operator adds these values across all specified columns to calculate the total number of checkboxes that are checked.
Applying this formula returns the number of checkboxes completed in the row.
The ‘Formula’ column now displays the count of checkboxes that were marked complete in the row.
Here’s how it must be read:
The chest workout was done once in the week while Arms and Core were worked on thrice.
4. Calculate the percentage of checkboxes marked complete
We now have the count of checkboxes marked as done. Let’s go one step further and calculate the percentage.
Next, we will figure out what percentage of days was each muscle group worked on.
There are two ways to do that — the first method includes creating a column that calculates the percentage by dividing the count by the total, and the second method employs the direct formula for that.
The first method is quite handy and finds its use while creating a progress bar in Notion but since this guide is all about the formulas, let’s discuss the second method.
We will tweak the formula for the existing column to display the percentage instead of the count.
Here’s the formula:
format(
round(
(
if(prop("Day 1"), 1, 0) +
if(prop("Day 2"), 1, 0) +
if(prop("Day 3"), 1, 0) +
if(prop("Day 4"), 1, 0) +
if(prop("Day 5"), 1, 0) +
if(prop("Day 6"), 1, 0) +
if(prop("Day 7"), 1, 0)
) / TotalDays * 100 * 100
) / 100
) + " %"
And here’s what each component does:
if(prop("Day X"), 1, 0)
Checks if the checkbox for a specific day is ticked:
- If true (checked), it assigns a value of 1.
- If false (unchecked), it assigns a value of 0.
Summing up the if statements
if(prop("Day 1"), 1, 0) + if(prop("Day 2"), 1, 0) + ...
- Adds up the results for all the checkboxes (e.g., Monday to Sunday).
- The result is the total number of checkboxes checked for the week.
/ TotalDays
- Divides the total count of checked boxes by the total number of possible checkboxes.
- This gives the fraction of completed checkboxes.
* 100
Multiplies the fraction by 100 to convert it into a percentage.
100 (Scaling to Preserve Decimals)
Multiplies the percentage by 100 again to preserve precision for rounding.
round()
Rounds the scaled value to the nearest integer.
/ 100
Divides the rounded value by 100 to bring it back to its original scale (but now rounded to two decimal places).
format()
Converts the numerical result into a text string, which is necessary to append the % symbol.
+ "%"
Appends the % symbol to the formatted string. You could skip this step and update the percentage number type under the formula settings.
In our example, we will arrive at the percentage of the week when the user worked on their specific muscle groups.
And here’s what the numbers suggest:
The user works on their chest muscles for 14% of the week and on their core for 43% of their week.
Get Super’s bi-weekly Notion Newsletter
- Custom design
- SEO options
- Instant page load