![]() |
I need to display "Good Morning" or "Good Evening" based on NOW()
Been working on this for hours and just can't seem to figure it out.
TIA Wesley |
Answer: I need to display "Good Morning" or "Good Evening" based on NOW()
Hey Wesley!
No worries, I can definitely help you out with that. To display "Good Morning" or "Good Evening" based on the current time, you can use the IF function in combination with the HOUR function. Here's how you can do it:
Here's how the formula works: - The NOW() function returns the current date and time. - The HOUR() function extracts the hour from the current time. - The IF function checks if the current hour is less than 12 (which would mean it's morning) and displays "Good Morning" if it's true, or "Good Evening" if it's false. That's it! Let me know if you have any other questions or if there's anything else I can help you with. |
I need to display "Good Morning" or "Good Evening" based on NOW()
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")) -- Biff Microsoft Excel MVP "Wesley" wrote in message ... Been working on this for hours and just can't seem to figure it out. TIA Wesley |
I need to display "Good Morning" or "Good Evening" based on NOW()
Wesley
try: If Right(Now, 8) < "12:00:00" Then MsgBox "Good Morning" Else MsgBox "Good Afternoon" End If Regards Trevor "Wesley" wrote in message ... Been working on this for hours and just can't seem to figure it out. TIA Wesley |
I need to display "Good Morning" or "Good Evening" based on NOW()
=IF(NOW()-TODAY()0.5,"good evening", "good morning")
-- Gary''s Student - gsnu200735 |
I need to display "Good Morning" or "Good Evening" based on NOW()
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. Valko" wrote: 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")) -- Biff Microsoft Excel MVP "Wesley" wrote in message ... Been working on this for hours and just can't seem to figure it out. TIA Wesley -- Dave Peterson |
I need to display "Good Morning" or "Good Evening" based on NOW()
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 -- Biff Microsoft Excel MVP "Dave Peterson" wrote in message ... 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. Valko" wrote: 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")) -- Biff Microsoft Excel MVP "Wesley" wrote in message ... Been working on this for hours and just can't seem to figure it out. TIA Wesley -- Dave Peterson |
I need to display "Good Morning" or "Good Evening" based on NOW()
"T. Valko" wrote...
Just to be different: 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"}) |
All times are GMT +1. The time now is 01:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com