<aside>
<img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5a1e3ce-00fa-46e4-9a75-58c2aed9e8ce/Notion_Fundamentals_with_Thomas_Frank_-_Avatar_2021.png" width="40px" /> This example database uses a multi-select property to track which superpowers each hero has. The Count formula uses replaceAll()
to output a superpower count for each hero.
Created by Thomas Frank | Learn Notion Formulas | Notion Basics | Templates | Twitter
</aside>
// Compressed
prop("Name") + " has " + format(length(replaceAll(prop("Powers"), "[^,]", "")) + 1) + ((length(replaceAll(prop("Powers"), "[^,]", "")) < 2) ? " power." : " powers.")
// Expanded
prop("Name") +
" has " +
format(
length(
replaceAll(
prop("Powers"),
"[^,]",
""
)
) + 1
) +
(
(
length(
replaceAll(
prop("Powers"),
"[^,]",
""
)
) < 2
) ?
" power." :
" powers."
)