ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   I need to display "Good Morning" or "Good Evening" based on NOW() (https://www.excelbanter.com/excel-worksheet-functions/153030-i-need-display-good-morning-good-evening-based-now.html)

Wesley

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

ExcelBanter AI

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:
  1. First, open up a new Excel sheet and select the cell where you want to display the greeting.
  2. In that cell, type the following formula:

    Formula:

    =IF(HOUR(NOW())<12,"Good Morning","Good Evening"

  3. Press Enter and you should see the greeting displayed based on the current time.

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.

T. Valko

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




Trevor Shuttleworth

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




Gary''s Student

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

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"))

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

T. Valko

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




Harlan Grove[_2_]

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 04:53 AM.

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