You can create a countdown timer in Excel that counts the number of days, hours, and minutes until some date by using the NOW() function.
The following step-by-step example shows how to use this function to create a countdown timer in practice.
Step 1: Enter the Countdown Date
Suppose today is 7/18/2023.
I will create a countdown timer in Excel that counts the number of days, hours, minutes and seconds until 8/1/2023:
Step 2: Create the Formulas for Counting Down
Next, we can use the following formulas to count the number of days, hours, minutes and seconds until 8/1/2023:
- Days: =INT(A2-NOW())
- Hours: =HOUR(A2-NOW())
- Minutes: =MINUTE(A2-NOW())
- Seconds: =SECOND(A2-NOW())
We can type these formulas into each of their own cells:
This tells us that the date 8/1/2023 is 13 days, 14 hours, 23 minutes and 11 seconds away.
Step 3: Manually Update the Countdown Timer
To update the countdown timer, you simply need to double click any cell in the Excel spreadsheet and then press Enter.
The countdown timer will automatically update the values for the days, hours, minutes and seconds as soon as you press Enter:
Step 4: Automatically Update the Countdown Timer (Optional)
If you would like the countdown timer to automatically update by itself at specific intervals, you will need to write some simple code in VBA.
Before we do so, we need to make sure the Developer tab is visible on the top ribbon in Excel.
To do so, click the File tab, then click Options, then click Customize Ribbon.
Under the section called Main Tabs, check the box next to Developer, then click OK:
Next, click the Developer tab along the top ribbon and then click the Visual Basic icon:
Next, click the Insert tab and then click Module from the dropdown menu:
Next, paste the following code into the module code editor:
Sub UpdateCountdown()
Range("C2:F2").Calculate
Application.OnTime DateAdd("s", 1, Now), "UpdateCountdown"
End Sub
Next, click the little green Play arrow to execute this VBA code:
Once you’ve entered the code, feel free to close out of the VB Editor. The code will automatically be saved.
The values for the days, hours, minutes and seconds will now automatically update every second in the spreadsheet.
Additional Resources
The following tutorials explain how to perform other common tasks in Excel:
Excel: How to Subtract Minutes from Time
Excel: How to Extract Hour from Datetime
Excel: How to Format Time with Milliseconds