findIndex

Learn how to use the findIndex function in Notion formulas.

The findIndex() function will return the index number of the first item in a list that matches the condition. If you want to return the item itself, use find.

findIndex(list, condition)

list.findIndex(condition)
Code language: JavaScript (javascript)

Note that lists use zero-based indexing, so 0 will be returned for the first value.

This formula finds the index of the first item in the list that can be parsed to a date:

[1, "Monkey D. Luffy", true, "2025-01-01", 37, "1999-12-23"].findIndex(
  current.parseDate()
)

/* Output: 3 */
Code language: JavaScript (javascript)

This variation finds the index of the first item that can be parsed to a date and that is before Jan 1, 2000:

[1, "Monkey D. Luffy", true, "2025-01-01", 37, "1999-12-23"].findIndex(
  current.parseDate() < "2000-01-01".parseDate()
)

/* Output: 5 */
Code language: JavaScript (javascript)
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