# empty

Learn how to use the empty function in Notion formulas.

The

`empty()`

function returns true if its argument is empty, or has a value that equates to empty - including `0`

and `false`

.1

empty(string)

2

empty(number)

3

empty(Boolean)

4

empty(date)

1

empty("") // Output: true

2

3

empty(0) // Output: true

4

5

empty(false) // Output: true

6

7

// Assume a row where the Name property is currently blank

8

empty(prop("Name")) // Output: true

1

// Assume a row where the Name property contains text

2

not empty(prop("Name")) // Output: true

3

4

// The same result can be accomplished with conditional operators

5

// (Assume the Name property contains text in this row)

6

empty(prop("Name")) ? false : true // Output: true

The example database below shows how you can sort sub-tasks by their parent task's due date. This pictured view is simplified for ease-of-use; view the database's

**All Properties**tab to see every property at work.1

// Compressed

2

if(not empty(prop("Parent Task")), prop("Parent Due Rollup"), if(empty(prop("Sub-Tasks")), prop("Due"), if(not empty(prop("Due")), prop("Due"), dateAdd(now(), 100, "years"))))

3

4

// Expanded

5

if(

6

not empty(

7

prop("Parent Task")

8

),

9

prop("Parent Due Rollup"),

10

if(

11

empty(

12

prop("Sub-Tasks")

13

),

14

prop("Due"),

15

if(

16

not empty(

17

prop("Due")

18

),

19

prop("Due"),

20

dateAdd(

21

now(),

22

100,

23

"years"

24

)

25

)

26

)

27

)

This formula uses both

`empty()`

and `not empty()`

in conjunction with multiple nested if statements in order to determine a **Parent Due Date.**The entire database view is then sorted by:

- 1.Parent Due Date
- 2.Parent Task Name
- 3.Due Date

Notice that the formula also calls in a

**Parent Due Rollup**property, which is actually configured to pull in the Parent Due Date content of the Parent Task:That's right - this is a formula, which pulls in its own output (from other database rows)!

Let's work through what this formula is doing:

- 1.First, it checks if
**Parent Task**is not empty. If so, we know we're dealing with a sub-task, so we output the value of Parent Due Rollup.*Note that Parent Due Rollup's content is determined by the rest of the logic in this formula.* - 2.If Parent Task
*is*empty, then we check if**Sub-Tasks**is empty as well. If so, we're dealing with a "lone" task - it's not a parent task nor a sub-task. In this case, we output its Due date value. - 3.If Sub-Tasks is not empty, then we know we're dealing with a parent task. Next, we check if its
**Due**property is not empty.

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.

Last modified 4mo ago