Mooboos

New Member
Joined
Mar 9, 2016
Messages
8
Hi There

I have a three shifts
06:00-14:00- Morning
14:00-22:00- Evening
22:00-06:00- Nights

I have a range of times E2 Column such as
18:44
21:49
02:59
06:54
(ect)

I want to return in the column next to the time if the time falls in-between the shift times whether its a Morning, Evening or night shift?

Can anyone help?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hello--

It can be done like this--

However you will first need to insert an extra column--
assuming you have eg 18:44 in A1 then in cell b2---

write =N(A1)

(to convert time to numericals--a format that excel will understand in order to use if(or) statement)


and then-- in cell c1 copy paste this formula

=IF(OR(B1<0.25,B1>0.916667),"night",IF(AND(B1>0.25,B1<0.58333),"morn",IF(AND(B1>0.58333,B1<0.91667),"eve","Outofrange")))
 
Last edited:
Upvote 0
Hi, welcome to the forum.

Another option for you to consider:


Excel 2013
AB
1TimeShift
218:44Evening
321:49Evening
402:59Night
506:54Morning
Sheet1
Cell Formulas
RangeFormula
B2=LOOKUP(A2,0+{"00:00","06:00","14:00","22:00"},{"Night","Morning","Evening","Night"})
 
Upvote 0
Hi
Both or your formula's paste fine- Thank you

However when I drag the formula down to the next time cell (row 2) it just coppies the same shift name as above
EG

19:30 Night
08:36 Night
14:02 Night

Thanks
 
Upvote 0
Hi, the formula copies down fine for me, do you have calculation set to manual? Can you post the exact formula you tried?


Excel 2013
AB
1TimeShift
219:30Evening
308:36Morning
414:02Evening
Sheet1
Cell Formulas
RangeFormula
B2=LOOKUP(A2,0+{"00:00","06:00","14:00","22:00"},{"Night","Morning","Evening","Night"})
 
Upvote 0
Is your calculation set to manual as both formulas posted copy down fine for me?

Edit: slow at typing as FormeR replied as I was posting.
 
Last edited:
Upvote 0
A1B2
19:30:00Night

08:36:00Night
14:02:00Night
14:04:24Night
In B2 I have ^

<tbody>
PHP:
[PHP][PHP][PHP][PHP]=LOOKUP(A2,0+{"00:00","06:00","14:00","22:00"},{"Night","Morning","Evening","Night"})
[/PHP][/PHP][/PHP][/PHP][TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
</tr>
</tbody>
 
Upvote 0
Do you also have dates in the those cells, if so try:

=LOOKUP(MOD(A2,1),0+{"00:00","06:00","14:00","22:00"},{"Night","Morning","Evening","Night"})
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top