Time

Y

ynissel

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

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
 
Y

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 !!",""),"")
 
M

Matt Lunn

Hi,

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

=IF(A1>TIME(17,30,0),TRUE,FALSE)

ThaNKS
 
Y

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
 
S

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
[email protected]
Replace@mailinator with @tiscali.co.uk
 
Y

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
 
C

CLR

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

Vaya con Dios,
Chuck, CABGx3
 
M

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
 
Top