How to use the NOW function
What is the NOW function?
The NOW function returns the current date and time. It is a volatile function.
Table of Contents
1. Introduction
What is time in Excel?
Excel time value is a number equal to or larger than 0 (zero) and smaller than 1, formatted as a time value. One hour is 1/24, there are 24 hours in one day.
One minute is 1/1440, there are 1440 minutes in one day (60*24 = 1440). One second is 1/86400, there are 86400 seconds in one day (60*60*24 = 86400).
The following table shows whole hours, one hour is 1/24, 2 hours is 2/24, and so on.
0 - 12:00:00 AM
1/24 - 1:00:00 AM
2/24 - 2:00:00 AM
...
23/24 - 11:00:00 PM
24/24 - 12:00:00 AM
The time value is only the decimal part of a number, in other words, a value larger than or equal to 1 makes no difference, Excel uses only the decimal part of a number to create an Excel time value.
1.5 -> 0.5 -> 12:00:00 PM
The whole numbers represent dates in Excel. The whole number and the decimal part create a date and time value. Here is an example: 1.5 represents 1/1/1900 12:00 PM
What are dates in Excel?
Dates are stored numerically but formatted to display in human-readable date/time formats, this enables Excel to do work with dates in calculations.
For example, dates are stored as sequential serial numbers with 1 being January 1, 1900 by default. The integer part (whole number) represents the date the decimal part represents the time.
This allows dates to easily be formatted to display in many date/time formats like mm/dd/yyyy, dd/mm/yyyy and so on and still be part of calculations as long as the date is stored numerically in a cell.
What is a volatile function?
The NOW function is a volatile function, it updates each time you recalculate the worksheet.
What is the effect of volatile functions?
They may slow down your worksheet/workbook if you have many volatile functions. Use with caution, it may slow down your workbook considerably if used extensively.
When is the worksheet calculated?
Cells containing non volatile functions are only calculated once or until you force a recalculation, however, volatile functions are recalculated each time you type in a cell and press enter.
Can you stop recalculating a worksheet?
Yes, you can change a setting to manual recalculations.
- Go to tab "Formulas".
- Press with left mouse button on the "Calculation Options" button, a popup menu appears.
- Press with mouse on "Manual".
This stops the automatic recalculations.
How to force a recalculation?
Pressing F9 key will recalculate or refresh all the formulas and values in every worksheet of every workbook you have open.
Pressing Shift+F9 will only recalculate the formulas and values on the single worksheet you're currently viewing or active.
Pressing Ctrl+Alt+F9 is the quickest way to force a full recalculation of absolutely everything in all open workbooks, even if nothing has changed. It ignores whether changes were made or not and completely recomputes.
Are there more volatile functions in Excel?
Yes. OFFSET, TODAY, RAND among others.
Function | Syntax | Description |
---|---|---|
OFFSET | OFFSET(reference, rows, cols) | Returns a cell offset from a reference cell. |
TODAY | TODAY() | Returns the current date. |
RAND | RAND() | Returns a random decimal between 0 and 1. |
RANDARRAY | RANDARRAY([rows], [columns], [min], [max], [whole_number]) | Returns an array with random numbers. |
RANDBETWEEN | RANDBETWEEN(bottom, top) | Returns a random whole number between bottom and top |
Note, that conditional formatting is extremely volatile or super-volatile meaning it is recalculated as you scroll through a worksheet.
2. NOW function Syntax
NOW()
The NOW function has no arguments.
3. Example 1
This example shows different ways you can use the NOW function. Cell B3 returns the current date and time value which Excel formats as year, month, day, etc.
Formula in cell B3:
The formula in cell E2 calculates the year based on the output from the NOW function:
The formula returns 2024 which represents the current year. The formula in cell E3 extracts the month from the NOW function's result:
This formula displays 8, indicating the eighth month of the year (August). The formula in cell E4 determines the day of the month using the NOW function:
It produces 22, corresponding to the 22nd day of the current month. The formula in cell E5 computes the day of the week from the NOW function's output:
The result 5 signifies the fifth day of the week (Thursday, assuming Sunday is day 1). The formula in cell E6 ascertains the week number within the year:
It returns 34, denoting the 34th week of the current year. The formula in cell E7 derives the hour from the NOW function's timestamp:
The output 8 represents the 8th hour of the day in 24-hour format. The formula in cell E8 extracts the minute component from the NOW function:
It shows 42, indicating 42 minutes past the hour. The formula in cell E9 retrieves the seconds from the NOW function's result:
The value 25 reflects the number of seconds elapsed in the current minute.
All these examples refreshes automatically every time the worksheet is recalculated, this is why it is a volatile function. The advantage is that you always have an accurate up to date value you can work with.
3. Example 2
The image shows a spreadsheet with information about a project's elapsed time. Cell B3 contains the project start date: 6/1/2024. The formulas in cells E3 and E4 calculate the elapsed time since the project started:
Formula in cell E3:
This formula calculates the number of whole days that have passed since the project start date. It subtracts the start date from the current date and time (NOW()), then rounds down to the nearest integer. The result shown is 82 days.
- NOW(): Returns the current date and time.
- B3: This is a reference to a cell that contains a date and time value.
- NOW()-B3: Subtracts the value in cell B3 from the current date and time, resulting in a time difference.
- ROUNDDOWN(...,0): Rounds down the time difference to the nearest whole number (i.e., the nearest day). The 0 argument specifies that we want to round down to the nearest whole number.
Formula in cell E3:
This formula calculates the additional hours beyond the whole days. It first subtracts the start date from the current date/time, then subtracts the integer part of this difference (whole days), leaving only the fractional part. The HOUR function then extracts the hours from this fraction. The result shown is 9 hours.
- NOW(): Returns the current date and time.
- B3: This is a reference to a cell that contains a date and time value.
- NOW()-B3: Subtracts the value in cell B3 from the current date and time, resulting in a time difference.
- INT(NOW()-B3): Converts the time difference to an integer, effectively removing the fractional part (i.e., the hours, minutes, and seconds). This leaves us with the whole number of days.
- NOW()-B3-INT(NOW()-B3): Subtracts the whole number of days from the original time difference, leaving us with the remaining hours, minutes, and seconds.
- HOUR(...): Extracts the hour component from the remaining time difference.
According to the spreadsheet, 82 days and 9 hours have elapsed since the project started on 6/1/2024.
7. Calculate time between time zones
This article demonstrates how to build a time zone chart and calculate times different than your time zone.
The worksheet below lets you enter cities and their time difference. Excel calculates the corresponding local times in E5:E8. Press F9 to refresh the time and date in cell E3.
What's on this section
- How to calculate time zone differences
- Find the time difference
- How to create a time zone chart
- How I built the chart
- Values and formulas
- Insert a drop down list
- Insert a column Chart
- Adjust and remove vertical axis
- Remove legend and major horizontal gridlines
- Add vertical grid lines
- Add map to chart background
- Adjust column gap width and transparency
- How I built the chart
- Get Excel file
7.1. How to calculate time zone differences
This worksheet lets you enter cities and their time difference. Excel calculates the corresponding local times in E5:E8. Press F9 to refresh the time and date in cell E3.
Formula in cell E3:
Formula in cell E5: =$E$3+C5/24 Copy this cell and paste to E6:E8. There are both absolute and relative cell references in this formula.
Did you know that Excel stores date and time as a number? 16 June 2015 is stored as 42171. 16 June 2015 12:00 is 42171.5. Time is the decimal part of the number (0.5) and the date is 42171.
You can verify that this is true, type a date in a cell. Select the cell and press CTRL + 1. Change the formatting to General.
To add 7 hours to a datetime value you need to divide the hours by 24. 7/24 + 42171 = 42171.02916667. That explains the formula in cell E5: =$E$3+C5/24
Another example, 24 hours (1 day) is equal to 1. 42171 + 24 hours is 42171 + 24/24 = 42172.
7.2. Find the time difference
How do you know the time difference between where you live and another city/country? You don't, some countries use daylight saving time (summertime) or have changed their time zone. It can be really confusing.
Go to https://www.timeanddate.com/worldclock/ and search for a city, it is the only way.
Type the time difference in column C, Excel calculates the time for you in column E.
7.3. How to create a time zone chart
This chart shows you the world divided into 24 time zones, in a perfect world this could be useful. Unfortunately, it is pretty much useless.
Don't use this chart to find the time difference between the two cities. It is not accurate, some countries have changed their time zone and use daylight saving time.
I have included this chart in this post only to show you how I built it.
7.3.1 How I built the chart
7.3.1.1 Values and formulas
- Go to sheet2
- Type these values in columns B and C, see pic below.
- Type this formula in cell D2: =IF(B2=Sheet1!$D$12, 1, 0)
- Copy cell D2 and paste to D3:D26
7.3.1.2 Insert a Drop-down List
- Go to sheet1, select cell D12
- Go to tab "Data"
- Press with left mouse button on the "Data Validation" button
- Select List
- Enter these numbers: -12, -11, ... -1, 0, +1, ... , +14
- Press with left mouse button on OK.
7.3.1.3 Insert a column Chart
- Go to sheet2.
- Select cell range B2:C26.
- Go to tab "Insert" on the ribbon.
- Press with left mouse button on the "Column chart" button.
- Press with right mouse button on on the chart and press with left mouse button on "Select Data...".
- Press with left mouse button on the "Edit" button below Horizontal (Category) Axis Labels.
- Select cell range B2:B26.
- Press with left mouse button on OK.
- Select "Series1".
- Press with left mouse button on the "Edit" button.
- Select cell range C2:C26 as series values.
- Press with left mouse button on OK.
- Select Series2.
- Press with left mouse button on "Remove" button.
- Press with left mouse button on OK.
7.3.1.4 Adjust and remove vertical axis
- Press with right mouse button on on the vertical axis.
- Press with left mouse button on "Format Axis...".
- Change "Maximum Value" to "Fixed" and type 1.
- Press with left mouse button on "Close" button.
- Select "Vertical Axis" and press Delete.
7.3.1.5 Remove legend and major horizontal gridlines
- Select "Legend".
- Delete "Legend".
- Select major horizontal gridlines.
- Delete.
7.3.1.6 Add vertical grid lines
- Select chart.
- Go to tab "Layout" on the ribbon.
- Press with left mouse button on "Gridlines" button.
- Press with left mouse button on "Primary Vertical Gridlines".
- Press with left mouse button on "Major Gridlines".
7.3.1.7 Add map to chart background
I found a world map at wikimedia commons. Copy picture (Ctrl + C)
- Press with right mouse button on on plot area.
- Press with left mouse button on "Format Plot Area...".
- Press with left mouse button on "Picture or texture fill".
- Press with left mouse button on "Clipboard" button.
- Press with left mouse button on Close button.
7.3.1.8 Adjust column gap width and transparency
- Press with right mouse button on on the column.
- Press with left mouse button on "Format Data Series...".
- Change gap width to 0%.
- Go to the "Fill" category.
- Press with left mouse button on "Solid fill".
- Change transparency to 50%.
- Press with left mouse button on the Close button.
'NOW' function examples
Functions in 'Date and Time' category
The NOW function function is one of 22 functions in the 'Date and Time' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form