ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Need IF statement to categorize time into "Morning", "Afternoon", "Evening" (https://www.excelbanter.com/excel-discussion-misc-queries/448848-need-if-statement-categorize-time-into-morning-afternoon-evening.html)

JFire

Need IF statement to categorize time into "Morning", "Afternoon", "Evening"
 
I have a column of time stamps that I need to group into

- Morning: 4AM - 11AM
- Afternoon: 11:01AM - 3PM
- Evening: 3:01PM - 3:59AM

Can you help?

Claus Busch

Need IF statement to categorize time into "Morning", "Afternoon", "Evening"
 
Hi,

Am Thu, 6 Jun 2013 16:06:21 +0100 schrieb JFi

I have a column of time stamps that I need to group into

- Morning: 4AM - 11AM
- Afternoon: 11:01AM - 3PM
- Evening: 3:01PM - 3:59AM


try:
=IF(AND(A1=TIME(4,,),A1<TIME(11,,)),"Morning",IF( AND(A1=TIME(11,,),A1<TIME(15,,)),"Afternoon","Eve ning"))


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Kevin@Radstock

Hi

Another way would be the LOOKUP function:
=LOOKUP(A1,{"00:00","04:00","11:00","15:00"}+0,{"E vening","Morning","Afternoon","Evening"})

You will have to remove the space after the "O" in morning as this site keeps on inserting the space for some reason!!!!

Quote:

Originally Posted by JFire (Post 1612167)
I have a column of time stamps that I need to group into

- Morning: 4AM - 11AM
- Afternoon: 11:01AM - 3PM
- Evening: 3:01PM - 3:59AM

Can you help?



All times are GMT +1. The time now is 07:44 PM.

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