Hi to all.
if hour > 6 and < 12 = good morning
if hour > 12 and < 17 = good afternoon
if hour > 17 = good evenig
with vba?
xam
Hi to all.
if hour > 6 and < 12 = good morning
if hour > 12 and < 17 = good afternoon
if hour > 17 = good evenig
with vba?
xam
Last edited by xam99; 10-28-2019 at 05:14 AM.
How aboutThis needs to go in the "ThisWorkbook" modulePlease Login or Register to view this content.
Hi fluff13 the macro work well.
Thanks you.
xam
Thank you fluff13
Last edited by xam99; 10-26-2019 at 05:55 PM.
Formula Solution (moved from closed duplicate thread):
The formula will go in cell M1:
=IF(AND(L1>=6,L1<=12),"good morning",IF(L1<=17,"good afternoon",IF(L1<=20,"good evening",IF(OR(L1<6,L1>20),"good night",""))))
If you have actual times in L1 rather than just numbers, you will need a different formula.
Hope this helps.
Pete
Last edited by AliGW; 10-27-2019 at 03:43 AM.
Hi peteuk,
your formula it is not so exact the 1/2/3/4/5 hours must be "good night"
it must be like this
1 Good night
2 Good night
3 Good night
4 Good night
5 Good night
6 Good morning
7 Good morning
8 Good morning
9 Good morning
10 Good morning
11 Good morning
12 Good morning
13 Good afternoon
14 Good afternoon
15 Good afternoon
16 Good afternoon
17 Good afternoon
18 Good afternoon
19 Good evening
20 Good evening
21 Good evening
22 Good night
23 Good night
24 Good night
0 Good night
xam
Last edited by xam99; 10-28-2019 at 04:18 AM.
Nice and descriptive title. I seem to recognize someone's hand
Last edited by Pepe Le Mokko; 10-28-2019 at 07:50 AM.
I had put the thread to request a goodmorning formula
but someone moved it here in the vba goodmorning thread
You are completely missing the point!
The reason the other thread was closed is because it was a duplicate of this one (same request essentially).
This is about your inadequate thread title. I suggest you change the thread title to this: "Formula or Code to Convert Numbers to Text Based on Value".
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
It just needs a slight re-arrangement of the formula in M1:
=IF(OR(L1<6,L1>20),"good night",IF(AND(L1>=6,L1<=12),"good morning",IF(L1<=17,"good afternoon",IF(L1<=20,"good evening",""))))
Copy down as required.
Hope this helps.
Pete
hello pete_uk now works.
Thanks
xam
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks