If you manage tasks in Notion, you might find it convenient to have a "X days left until deadline" display.
This time, I created such a deadline display using formulas!
In this article, I will introduce the formula code that you can use by simply copying and pasting, as well as how to customize it.
I'll explain it in a way that even those who are "not good with formulas" or "haven't mastered Notion yet" can understand, so please read to the end!
🎬 Director:Rei
✍🏻 Writer:Minokurumi
1. Preparation: Prepare a Database
First, prepare a task database to add the formula to, and make sure it has the following properties.
If you are already managing tasks in Notion, you can use your existing database as long as it has the properties introduced below.
You can use the example names or your own custom names.
-
Status property
-
Date property (for deadline)
-
Formula property
🔗If you don't know how to create a database, click here!
The status can also be displayed as a checkbox, so you can choose your preferred format.
🔧 How to change the status display method
You can select either a checkbox or select format by editing the property → display method.
2. Formula provided (code distribution)
Once you've prepared, let's add the formula. The overall structure of the formula used this time is as follows:
lets(
/* Defines "Days until deadline" as a variable named "〆切まで" (Deadline Left) */
〆切まで,dateBetween(prop("〆切"),now(),"days") + 1,
ifs(
/* ①If the status is "完了" (Completed), display "完了" in the specified style */
prop("ステータス") == "完了", "完了".style("c,gray,gray_background"),
/* ②If no deadline is entered, display "〆切なし" (No deadline) in the specified style */
prop("〆切").empty(), "〆切なし".style("c,blue,blue_background"),
/* ③If the deadline is today, display "今日" (Today) in the specified style */
prop("〆切").formatDate("YYYY/MM/DD") == today().formatDate("YYYY/MM/DD") , "今日".style("c,red,red_background"),
/* ④If the deadline has passed, display "〆切超過" (Deadline exceeded) in the specified style */
dateBetween(prop("〆切"),today(),"days")<1 , "〆切超過".style("c,red,red_background"),
/* ⑤If there are 3 days or less until the deadline, display "残り●日" (● days left) in the specified style */
〆切まで >= 1 && 〆切まで <= 3, style("残り" + 〆切まで + "日","c,yellow,yellow_background"),
/* ⑥If there are 4 or more days until the deadline, display "残り●日" (● days left) in the specified style */
〆切まで >= 4,style("残り" + 〆切まで + "日","c,green,green_background")
)
)
3. How to customize (code provided)
While the formula is perfectly usable as is, here's how to further customize its appearance and some design ideas for those who want to do so.
All the design ideas introduced will have their code provided at the end, so if you want to use them as-is, feel free to do so!
Customization ①: Change the text content
If you want to change the displayed text, modify the text immediately preceding the ".style" function. The text is enclosed in "" marks; do not delete these, only change the content within them.
Example: If you want to change "完了" (Completed) to "完了済み" (Finished)
Change code ① as follows:
/* ①If the status is "完了" (Completed), display "完了" in the specified style */
prop("ステータス") == "完了", "完了済み".style("c,gray,gray_background"),
For ⑤ and ⑥, the writing is different from the others, but the "残り" (remaining) and "日" (days) text can be changed in the same way. If you want to completely delete either one, also delete the corresponding "+" signs.
/* ⑥If there are 4 or more days until the deadline, display "残り●日" (● days left) in the specified style */
〆切まで >= 4,style("残り" + 〆切まで + "日","c,green,green_background")
Customization ②: Change the text style
In the example below, the "code" text style is used, with a rounded background behind the text. This text style can also be changed.
This is specified within the parentheses of each ".style" in ① to ⑤. In the example, the code "c" is at the beginning of the parentheses, so you can replace it with the code for the desired style below.
/* ①If the status is "完了" (Completed), display "完了" in the specified style */
prop("ステータス") == "完了", "完了".style("c,gray,gray_background"),
By the way, if you delete "c", it will revert to the normal style. In this case, also delete the comma immediately following it.
Customization ③: Change the text color
Similar to text style, text color and background color can also be customized. The customizable colors are as follows:
In this example, this is the part written after the "c" style mentioned earlier. This time, both text color and background color are specified.
To change the color, simply change each color name to one of the options above.
/* ①If the status is "完了" (Completed), display "完了" in the specified style */
prop("ステータス") == "完了", "完了".style("c,gray,gray_background"),
[Design Idea Distribution]
This time, I've created 7 display patterns. You can copy and paste all the codes from below, so choose your favorite!

As a bonus, the style codes and color codes from earlier are also included here for you to copy and paste. Please feel free to use them!
Summary
That was an introduction to the formula for displaying "X days left until deadline" in Notion!
Formulas can seem difficult, but mastering them expands the possibilities of what you can do with Notion. Take this opportunity to gradually start experimenting with them.
Here's "Todotion", the ultimate task management template realized with Notion!
A 2-hour "Notion Master Course" is now available, where you can learn Notion from scratch through videos!
The book "Notion Life Hacks", introducing 36 ways to use Notion, is also now on sale!






