Notion logo in 3D

Creating a Simple Counter in Notion

So, you want to create a simple counter in Notion. Why? Who knows. Maybe you are like me and want to count rows while knitting. No judgement, I got you.

A simple counter with actions Increment, Decrement and Clear

Concepts

If we are going to manipulate data, we’ll need a database. A database is a container that holds database pages.

By default, every database will have the only property: Name of type Title. You can create additional properties to add more information to the pages within your database. Anytime you add a new property to a database, you’ll want to name the property and choose a property type.

We are going to use two additional types of properties: Number for our counter and Button to perform actions on its value.

Let’s build

First, we’ll need a database. Type /da and select “Database”, inline or full page. You should see an empty table:

An empty table

Name it, so you can easily reference its properties later. I’ll call mine “Counter”.

Add a new property you want to track. It should be of type Number. I’ll call mine “Value”.

Adding a new property Adding a new number property

Next, let’s create our buttons.

Add a new property to our database. Select a type Button and call it “Increment”. Edit an icon to a Plus if you wish and click “Edit automation”.

Adding a new button property

Here is where magic happens:

Editing an increment button

When the button is clicked, we want to increment our Value property.

Click “New action” and select “Edit property…”. Select “Value” and “Custom formula”.

Editing a custom formula for an increment button

You should see This page on the left side of the formula editor. Click it and type . to get access to its properties:

Editing a custom formula for an increment button

Click Value in the list of properties and type . again. You should see a list of available functions:

Editing a custom formula for an increment button

Select the add() function and provide 1 as an argument.

This is it – our recipe for incrementing is ready:

Increment button automation

Click Save and let’s try our button in action!

Create a new item in the database by clicking New page. A new row with a button “Increment” should appear. Click it and watch the value increase!

Incrementing value

Follow the same process to create the “Decrement” button: the only difference would be using the subtract() function in the action formula.

To save time, duplicate the “Increment” property and make changes.

Decrementing value

The only thing left is to create a “Clear” button. Duplicate one of the buttons again and instead of using a fancy formula just set the value to zero (you’ll need to convert a formula to text):

Converting formula to text Clearing value

That’s it! Rearrange your buttons, play with database views and have fun with your new counter ✨

List view of the database