Notion formula properties offer two text-related functions that behave very differently: Repeat() and Replace(). The Repeat() function duplicates a string a set number of times, while the Replace() function substitutes specific characters within a string. Many users confuse these two functions because both operate on text, but each solves a distinct problem. This article explains the exact syntax, behavior, and use cases for Repeat() and Replace(), and provides clear examples so you can pick the right function for your Notion databases.
Key Takeaways: Repeat() vs Replace() in Notion Formulas
- Repeat(“text”, N): Outputs the string “text” repeated N times, with no separator between copies.
- Replace(“source”, “old”, “new”): Replaces every occurrence of “old” in “source” with “new”, leaving the rest of the string unchanged.
- Use Repeat() for padding, progress bars, or generating repeated patterns: For example, Repeat(“⭐”, 3) returns “⭐⭐⭐”.
- Use Replace() for cleaning data, removing unwanted characters, or renaming items: For example, Replace(“hello-world”, “-“, ” “) returns “hello world”.
What Repeat() and Replace() Do in Notion Formulas
Both Repeat() and Replace() are text functions available in the Notion formula editor. They are part of the formula property type, which you add to a database by creating a new property and selecting “Formula” as the type. To use these functions, you must type them manually into the formula editor — there is no drag-and-drop interface for individual functions.
The Repeat() function accepts two arguments: the string to repeat and the number of repetitions. It outputs a single string containing the original string repeated consecutively. For example, Repeat(“ab”, 3) produces “ababab”. The function does not add spaces, commas, or any other separator between copies. If you need a separator, you must concatenate it manually using the + operator, like Repeat(“ab” + “, “, 3) which yields “ab, ab, ab, “. Note the trailing separator in the last copy — you may need to trim it with a slice or conditional logic.
The Replace() function accepts three arguments: the source string, the substring to find, and the replacement string. It scans the entire source string for every occurrence of the old substring and replaces each one with the new substring. Replace() is case-sensitive. If the old substring does not appear in the source string, Replace() returns the source string unchanged. Replace() does not support regular expressions or wildcards — it only matches exact literal text.
When to Use Each Function
Use Repeat() when you need to generate a repeated pattern for visual indicators like progress bars, star ratings, or separators. Use Replace() when you need to clean or transform existing text data, such as removing hyphens from phone numbers, replacing underscores with spaces, or standardizing naming conventions.
Steps to Use Repeat() and Replace() in a Notion Database
The following steps show how to create a formula property and test both functions. You need a Notion database with at least one text property to use as a data source for Replace().
- Add a formula property to your database
Open your Notion database. Click the + button in the last column header. Select “Formula” from the property type list. Name the property, for example “Progress Bar” or “Cleaned Name”. - Write a Repeat() formula for a progress bar
In the formula editor, type:if(prop("Status") == "Complete", Repeat("█", 10), Repeat("░", 10)). This displays 10 filled blocks when the Status property equals “Complete” and 10 empty blocks otherwise. Click “Save” to see the result. - Write a Replace() formula to clean a text field
Create another formula property named “Name Cleaned”. In the formula editor, type:Replace(prop("Full Name"), "-", " "). This replaces every hyphen in the Full Name property with a space. Click “Save” to apply. - Test the formulas with sample data
Add a row to your database. Set the “Status” property to “Complete” and the “Full Name” property to “John-Doe-Smith”. The Progress Bar formula should show 10 filled blocks. The Name Cleaned formula should display “John Doe Smith”. - Combine Repeat() and Replace() in one formula
Create a third formula property. Enter:Replace(Repeat("-", 10), "-", "="). The Repeat() function generates “———-“. The Replace() function changes every hyphen to an equals sign, producing “==========”. This demonstrates how the two functions can work together.
Common Mistakes and Limitations
Repeat() with zero or negative count
If you pass 0 as the count argument, Repeat() returns an empty string. If you pass a negative number, Notion returns an error. Always ensure the count is a non-negative integer. Use a conditional to handle edge cases: if(prop("Count") > 0, Repeat("x", prop("Count")), "").
Replace() is case-sensitive
Replace(“Hello World”, “hello”, “Hi”) returns “Hello World” unchanged because “hello” does not match “Hello”. Notion does not have a case-insensitive replace function. To work around this, use the lower() or upper() function on both the source and the search string before replacing, but this changes the case of the original text. For example: Replace(lower(prop("Name")), "john", "jane") converts the entire name to lowercase before replacing, so the output will be all lowercase.
Replace() replaces all occurrences, not just the first
Replace(“a-a-a”, “-“, “+”) returns “a+a+a”. There is no way to replace only the first or last occurrence using Replace() alone. To replace only the first occurrence, you must use a combination of slice() and concat(). For example: slice(prop("Text"), 0, index(prop("Text"), "-")) + "+" + slice(prop("Text"), index(prop("Text"), "-") + 1).
Repeat() does not add separators
Repeat(“item”, 3) returns “itemitemitem”. If you need “item, item, item”, you must add the separator inside the repeated string and then remove the trailing separator. A common pattern is: if(prop("Count") > 0, slice(Repeat(prop("Item") + ", ", prop("Count")), 0, -2), ""). This removes the last two characters (the comma and space) from the repeated string.
Repeat() vs Replace(): Function Comparison
| Item | Repeat() | Replace() |
|---|---|---|
| Purpose | Generate repeated text | Substitute characters in existing text |
| Arguments | (string, count) | (source, old, new) |
| Output on missing match | Empty string if count is 0 | Returns source unchanged |
| Case sensitivity | Preserves original case | Case-sensitive |
| Supports wildcards | No | No |
| Typical use case | Progress bars, separators, padding | Data cleaning, renaming, formatting |
You can now use Repeat() to create visual indicators in your Notion databases and Replace() to standardize text data. Try building a simple progress bar with Repeat() and a emoji character like █ or ⬜. For cleaning imported data, apply Replace() to remove extra spaces or dashes. An advanced tip: nest Replace() inside Repeat() to generate patterns and then transform them, as shown in step 5 above, to create custom visual effects without manual editing.