ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Time (https://www.excelbanter.com/excel-discussion-misc-queries/34966-time.html)

ynissel

Time
 
How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef

Matt Lunn

Hi,

Try this

=IF(NOW()TIME(17,30,0),TRUE,FALSE)

This checks against your current defined system time. It will not keep
checking by itself. To update you can press the F9 key.

Hope this helps,

Matt


"ynissel" wrote:

How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef


ynissel

Ill try thanks - I just figured out another way. yours is much cleaner.
=IF(HOUR(NOW())=17,IF(MINUTE(NOW())=30,"The lock desk closed at 5:30 PM,
please lock tomorrow !!",""),"")

"Matt Lunn" wrote:

Hi,

Try this

=IF(NOW()TIME(17,30,0),TRUE,FALSE)

This checks against your current defined system time. It will not keep
checking by itself. To update you can press the F9 key.

Hope this helps,

Matt


"ynissel" wrote:

How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef


Matt Lunn

Hi,

You could also use this if the time you wish to check against is in cell A1

=IF(A1TIME(17,30,0),TRUE,FALSE)

ThaNKS


"ynissel" wrote:

How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef


ynissel

OK - mine didnt work. but Im having an issue with yours as well
I typed in =IF(NOW()TIME(17,29,0),TRUE,FALSE) but its saying true and its
only 4:26 PM ??
Am I missing something ?
Thanks

"Matt Lunn" wrote:

Hi,

Try this

=IF(NOW()TIME(17,30,0),TRUE,FALSE)

This checks against your current defined system time. It will not keep
checking by itself. To update you can press the F9 key.

Hope this helps,

Matt


"ynissel" wrote:

How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef


ynissel

aaahhhhhhhhh
Sorry but Im frustrated - why isnt it working !!!

"Matt Lunn" wrote:

Hi,

You could also use this if the time you wish to check against is in cell A1

=IF(A1TIME(17,30,0),TRUE,FALSE)

ThaNKS


"ynissel" wrote:

How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef


Sandy Mann

The reason Matt's formula fails is because NOW() at the moment is 38545
point something or other which of course is bigger than any time which will
be less than one. To make your formula work try using MOD(NOW(),1)*24 in
place of HOUR
--
HTH


Sandy

Replace@mailinator with @tiscali.co.uk
"ynissel" wrote in message
...
OK - mine didnt work. but Im having an issue with yours as well
I typed in =IF(NOW()TIME(17,29,0),TRUE,FALSE) but its saying true and

its
only 4:26 PM ??
Am I missing something ?
Thanks

"Matt Lunn" wrote:

Hi,

Try this

=IF(NOW()TIME(17,30,0),TRUE,FALSE)

This checks against your current defined system time. It will not keep
checking by itself. To update you can press the F9 key.

Hope this helps,

Matt


"ynissel" wrote:

How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef




ynissel

worked like a charm ! Quite smart - looking at the remainder. damn why
cant they make some of these functions a bit easier !!

thanks !
Yosef


"ynissel" wrote:

How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef


CLR

=IF(((NOW()-INT(NOW()))0.729167),"After 5:30","Not 5:30 yet")

Vaya con Dios,
Chuck, CABGx3


"ynissel" wrote in message
...
How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef




Matt Lunn

Apologies for earlier posting being wrong, meant it to be:

=IF(TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW())) TIME(17,30,0),TRUE,FALSE)

Cheers,
Matt

"CLR" wrote:

=IF(((NOW()-INT(NOW()))0.729167),"After 5:30","Not 5:30 yet")

Vaya con Dios,
Chuck, CABGx3


"ynissel" wrote in message
...
How do I write an if statement to check if its past 5:30 PM. I tried
if(hour17.5) but that only checks the hr itself and not minutes.
Thanks,
Yosef






All times are GMT +1. The time now is 07:42 AM.

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