Database

Notion Formulas: Locate And Count Document Extensions

Screen Shot 2020-10-09 at 8.33.50 AM.png

📄 # Documents

Making a wiki inside Notion with plenty of imported documents? Add formulas like this one to keep track of the number of particular document extensions (ie. txt, md, pdf). Follow the syntax as described below to add more extension options. As well, the template has a “Total” property to find the sum of all files in a row.

Screen Shot 2020-10-09 at 8.43.52 AM.png

PDF example

contains(prop("Files"), ".pdf") ? ((length(prop("Files")) - length(replaceAll(prop("Files"), "[.]pdf", ""))) / 4) : 0

  • contains(prop("Files"), ".pdf")

    • find the extension

  • ? ((length(prop("Files")) - length(replaceAll(prop("Files"), "[.]pdf", "")))

    • if the extension is found, subtract the total length of the file(s) from the length of the file without the extension.

  • / 4)

    • Divide above result by number of characters in extension (including “.”). For “.pdf” … the number would be 4.

General Syntax

contains(prop("Files"), ".NAME OF EXTENSION") ? ((length(prop("Files")) - length(replaceAll(prop("Files"), "[.]NAME OF EXTENSION", ""))) / NUMBER OF CHARACTERS INCLUDING (.) IN EXTENSION) : 0

Extensions Included In Template

  • PDF

  • MD

  • XLS

  • TXT

  • CSV