I need to display "Good Morning" or "Good Evening" based on NOW()

T

T. Valko

Well, it depends on when evening starts.

How about this:

12:00 AM to 11:59 AM = Good Morning
12:00 PM to 5:59 PM = Good Afternoon
6:00 PM to 11:59 PM = Good Evening

=IF(MOD(NOW(),1)<0.5,"Good Morning",IF(MOD(NOW(),1)<0.75,"Good
Afternoon","Good Evening"))
 
T

Trevor Shuttleworth

Wesley

try:

If Right(Now, 8) < "12:00:00" Then
MsgBox "Good Morning"
Else
MsgBox "Good Afternoon"
End If

Regards

Trevor
 
D

Dave Peterson

Just to be different:

=IF(NOW()<TIME(12,0,0),"Good Morning",
IF(NOW()<TIME(18,0,0),"Good Afternoon","Good Evening"))

It might make changing those cutoff times a little easier.
 
T

T. Valko

Just to be different:
=IF(NOW()<TIME(12,0,0),"Good Morning",
IF(NOW()<TIME(18,0,0),"Good Afternoon","Good Evening"))

So where you are it's *always* going to be evening!

Yeah, that's different, alright. <bg>
 
H

Harlan Grove

Let's reformat that for clarity,

=IF(NOW()<TIME(12,0,0),
"Good Morning",
IF(NOW()<TIME(18,0,0),
"Good Afternoon",
"Good Evening"
)
)
So where you are it's *always* going to be evening!
....

One of the problems living in a time warp where clocks skip instantly from
noon to 6 PM.

But folling the cause of differentness,

="Good "&LOOKUP(HOUR(NOW()),{0;12;18;22},
{"Morning";"Afternoon";"Evening";"Night"})
 
Top