Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

3,312 views
Skip to first unread message

JFire

unread,
Jun 6, 2013, 11:06:21 AM6/6/13
to

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?




--
JFire

Claus Busch

unread,
Jun 6, 2013, 12:17:54 PM6/6/13
to
Hi,

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

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


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

Kevin@Radstock

unread,
Jun 7, 2013, 7:59:54 AM6/7/13
to

Hi

Another way would be the LOOKUP function:
=LOOKUP(A1,{0,0.1667,0.45833,0.625},{"Evening","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!!!!
Kevin@Radstock
0 new messages