# Running Countdown based on single select stage

Topic Labels: Formulas
Solved
1024 3
cancel
Showing results for
Did you mean:  5 - Automation Enthusiast

Hello all!

I want to have countdown (showing how many days left) based on the stage (a single select field) of a record. Each stage should take a certain amount of time to complete, so the goal is to see how many days left I have to complete a stage. Then once I change it to the next stage, that countdown is reset to the parameters of the next stage.

I have parameters are mostly set by formula-based date fields that live in the table. So it would look something like this:
If {Stage}=Stage 1, calculate difference between {date 1} & 14 days from {date 1}
If {Stage}=Stage 2, calculate difference between {date 2} & 14 days from {date 2}
If {Stage}=Stage 3, calculate difference between {date 3} & 28 days from {date 3}
If {Stage}=Stage Complete, “Complete”

I tried doing a DATETIME_DIFF inside of the If function, but have been struggling with errors. Seems pretty straight-forward, but I can’t figure it out…

Any help would be great! Thanks in advance.

1 Solution

Accepted Solutions  Airtable Employee

If I’m understanding your question correctly, you’d like to:

• Add a certain number of days to {Date} based on {Stage}
• Find the difference between the current time and whatever date was added from the step above

If that’s correct, here’s a formula you can use:

``````SWITCH(
{Stage},
"Stage 1",
"Stage 2",
"Stage 3",
"Complete", "Complete"
)
``````

This uses the `SWITCH()` function rather than IF statements for a slightly more straightforward approach. You’ll see in the GIF below how the countdown adjusts based on the entered date and the current time (the `NOW()` function in the formula). Let me know if that helps!

3 Replies 3  Airtable Employee

If I’m understanding your question correctly, you’d like to:

• Add a certain number of days to {Date} based on {Stage}
• Find the difference between the current time and whatever date was added from the step above

If that’s correct, here’s a formula you can use:

``````SWITCH(
{Stage},
"Stage 1",
"Stage 2",
"Stage 3",
"Complete", "Complete"
)
``````

This uses the `SWITCH()` function rather than IF statements for a slightly more straightforward approach. You’ll see in the GIF below how the countdown adjusts based on the entered date and the current time (the `NOW()` function in the formula). Let me know if that helps!  5 - Automation Enthusiast

Well that definitely worked. Thanks a ton!!  Airtable Employee

Happy to help out David! 