# Off Topic > Tips and Tutorials >  >  Determining Whether a Worked Shift Was Morning, Afternoon or Night

## ExcelTip

Problem:

We want to use the sign-in times from column A to determine whether a person was starting a morning, an afternoon, or a night shift.
For times before 12:00, the formula should return \"Morning Shift\".
For times between 12:00 and 16:00 the formula should return \"Afternoon Shift\".
For times after 16:00, the formula should return \"Night Shift\".

Solution:

Use the IF and TIME functions as shown in the following formula:
=IF(A2

----------


## cmxsevenfoldxmc

Where's the rest of the tip? I've been looking for this one tip for days and now that I finally find it, it's incomplete. Can the rest be posted up? Or what do I need to do to see the rest?

Thanks

----------


## oldchippy

You may have to buy the book to find the answer, it's on page 151, see link

http://www.exceltip.com/pl-f1ff_contents

or you could place your question in this forum?

----------


## daddylonglegs

Don't know what the tip actually says but this is a fairly basic IF formula

=IF(A2>=2/3,"Night",IF(A2>=0.5,"Afternoon","Morning"))&" Shift"

..or with LOOKUP

=LOOKUP(HOUR(A2),{0,12,16},{"Morning","Afternoon","Night"})&" Shift"

----------


## esaji

how to modify this formula to caculate morning from Morning shift  7am to 3pm - 3pm-11pm evening 11pm-7am night shift . I modified it but its not capturing night times correctly

=LOOKUP(HOUR(A2),{0,15,23},{"Morning","Evening","Night"})&" Shift"

----------


## esaji

I tired this formula and its working fine

=IF(HOUR(J2)<7,"Night Shift",IF(HOUR(J2)<15,"Morning Shift",IF(HOUR(J2)<23,"Evening Shift","Night Shift")))

----------


## AliGW

*Administrative Note:*

Welcome to the forum.  :Smilie: 

We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

Please see Forum Rule #4 about hijacking and start a new thread for your query.

If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

----------

