Returns the serial number of
the current date and time. If the cell format was General before the function
was entered, Excel changes the cell format so that it matches the date and time
format of your regional settings. You can change the date and time format for
the cell by using the commands in the Number group of the Home tab on the
Ribbon.
The NOW function is useful
when you need to display the current date and time on a worksheet or calculate
a value based on the current date and time, updated continuously when a
worksheet is changed or opened. The NOW function takes no arguments.
Syntax
The syntax for the NOW
function in Microsoft Excel is:
=NOW()
Parameters or Arguments
There are no parameters or
arguments for the NOW function.
Now Function Examples
Example 1
The following example shows a
simple use of the NOW function, run at 0840 hrs on 8th August 2015
Formula:
|
A
|
1
|
=NOW()
|
Result:
|
A
|
1
|
08/01/2017 16:00
|
Example 2
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:
|
A
|
B
|
1
|
Appointment
Time:
|
08/01/2017 17:30
|
2
|
Current
Date & Time:
|
=NOW( )
|
3
|
=IF( B1-B2
< 1/24, "!!! Due within 1 hr !!!", "Not yet due" )
|
Result at 1600 hrs on 1st Aug 2017:
|
A
|
B
|
1
|
Appointment
Time:
|
08/01/2017 17:30
|
2
|
Current
Date & Time:
|
08/01/2017 16:00
|
3
|
Not yet
due
|
|
Result at 1700 hrs on 1st Aug 2017:
|
A
|
B
|
1
|
Appointment
Time:
|
08/01/2017 17:30
|
2
|
Current
Date & Time:
|
08/01/2017 17:00
|
3
|
!!! Due
within 1 hr !!!
|
|
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.
If you need a static time that
won't change, you can enter the current
time using the keyboard shortcut Ctrl +
Shift + :
Reference:
follow us on
http://arivilm.blogspot.in
like us on
https://www.facebook.com/Arivilm2501/
No comments:
Post a Comment