Return Null/Empty Values in Formulas

Learn how to return a null (or empty) value from a Notion formula.

Unlike Javascript, Notion formulas do not have a null data type. However, it is possible to make a formula return a null/empty value using some easy workarounds.

To return a null/empty string, use a pair of double quotes "":

""

/* Testing emptiness */
empty("") /* Output: true */
Code language: JavaScript (javascript)

To return a null/empty number, use the following formula (credit to aNotioneer on Twitter for this number workaround):

toNumber("")

/* Testing emptiness */
empty(toNumber("")) /* Output: true */
Code language: JavaScript (javascript)

Likewise, you can return a null/empty date object using this formula:

parseDate("")

/* Testing emptiness */
empty(parseDate("")) /* Output: true */
Code language: JavaScript (javascript)

There is no possible null/empty state for Booleans/Checkboxes. However, you can convert Booleans to strings with format in order to create a setup where true/false/empty is possible:

/* Assume "Checkbox" is a Boolean/Checkbox property. 

/* Invalid; will throw an error: */
if( 1 > 2, prop("Checkbox"), "")

/* Valid. Will output "true", "false", or an empty value. */
if( 1 > 2, format(prop("Checkbox")), "")
Code language: JavaScript (javascript)

You can return an empty list by using the following formula:

[]

/* Testing emptiness */
empty([]) /* Output: true */

/* Adding an empty string, number, boolean, or list inside the 
square brackets will mean the list is no longer considered empty */
[""]
[0]
[false]
[[]]

/* Testing emptiness */
empty([""]) /* Output: false */
empty([0]) /* Output: false */
empty([false]) /* Output: false */
empty([[]]) /* Output: false */
Code language: JavaScript (javascript)

This example database demonstrates how outputting null/empty values from several formulas allows us to calculate a per-genre average rating inside a Movies database.

Return Null/Empty Values from Formulas

About the Author

My name is Thomas Frank, and I'm a Notion-certified writer, YouTuber, and template creator. I've been using Notion since 2018 to organize my personal life and to run my business and YouTube channel. In addition to this formula reference, I've created a free Notion course for beginners and several productivity-focused Notion templates. If you'd like to connect, follow me on Twitter.

🤔 Have an UB Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas

🤔 Have a Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas