ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extract time for comparison (https://www.excelbanter.com/excel-programming/410048-extract-time-comparison.html)

steven

Extract time for comparison
 
How do you extract the time from a cell that has the function now() in it.
For example I have a cell in a worksheet that might be hardcoded with the
time 14:30 and then I want to take the current time of the day and see if it
is greater than 14:30. The problem I am having is that using the now()
function even if the time is 12:00 today then it will still think it is
greater than 14:30 which is incorrect when just comparing the time.

Thank you,

Steven

Dave Peterson

Extract time for comparison
 
=now() includes both the date and time.

Maybe you could use:
=mod(now(),1)
(formatted as time)
to get the time (without the date).

Steven wrote:

How do you extract the time from a cell that has the function now() in it.
For example I have a cell in a worksheet that might be hardcoded with the
time 14:30 and then I want to take the current time of the day and see if it
is greater than 14:30. The problem I am having is that using the now()
function even if the time is 12:00 today then it will still think it is
greater than 14:30 which is incorrect when just comparing the time.

Thank you,

Steven


--

Dave Peterson

steven

Extract time for comparison
 
Thank you Mr Peterson.

"Dave Peterson" wrote:

=now() includes both the date and time.

Maybe you could use:
=mod(now(),1)
(formatted as time)
to get the time (without the date).

Steven wrote:

How do you extract the time from a cell that has the function now() in it.
For example I have a cell in a worksheet that might be hardcoded with the
time 14:30 and then I want to take the current time of the day and see if it
is greater than 14:30. The problem I am having is that using the now()
function even if the time is 12:00 today then it will still think it is
greater than 14:30 which is incorrect when just comparing the time.

Thank you,

Steven


--

Dave Peterson


Rick Rothstein \(MVP - VB\)[_1813_]

Extract time for comparison
 
Another alternative would be...

=NOW()-TODAY()

Rick


"Dave Peterson" wrote in message
...
=now() includes both the date and time.

Maybe you could use:
=mod(now(),1)
(formatted as time)
to get the time (without the date).

Steven wrote:

How do you extract the time from a cell that has the function now() in
it.
For example I have a cell in a worksheet that might be hardcoded with the
time 14:30 and then I want to take the current time of the day and see if
it
is greater than 14:30. The problem I am having is that using the now()
function even if the time is 12:00 today then it will still think it is
greater than 14:30 which is incorrect when just comparing the time.

Thank you,

Steven


--

Dave Peterson




All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com