The Excel NOW function returns the current date and time. The function receives no arguments and therefore, the function syntax is:
The NOW function updates every time your Excel worksheet is refreshed, and so any cells containing the function will be continually changing.
The following example shows a simple use of the NOW function, run at 0840 hrs on 8th August 2015
Formula:
|
Result:
|
The following example shows use of the NOW function, combined with the If function, to highlight when an appointment is due.
The function format is shown in the top spreadsheet and the results, at 2 different times, are shown in the two spreadsheets below.
Formula:
|
||||||||||||
Result at 1600 hrs on 8th Aug 2015:
|
||||||||||||
Result at 1700 hrs on 8th Aug 2015:
|
In the above example, the current time (returned by the NOW function) is subtracted from the appointment time and the result is compared against the value 1/24, which is the value of 1 hour in Excel (see the page on Excel Dates & Times for an explanation of this).
If the current time is less than 1 hour from the appointment time, the alert is displayed; otherwise the text "Not yet due" is displayed in cell C1.
The contents of cell C1 have been formatted to have red text, to make the alert stand out more.
Note that the above appointment alert will only work if your spreadsheet is being continually updated. While the spreadsheet is unused, the contents of cell C1 will stay the same as at the last evaluation.
For further information on the Excel Now function, see the Microsoft Office website.