help with formula to return text based on time values falling within range

BSWJON

Board Regular
Joined
Mar 24, 2014
Messages
109
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have a data file with date values in column B and time values in column J. I would like to insert a formula into column O that returns the shift which the time value pertains to. The shifts are as follows:

0600-1400: Day Shift
14:00 to 22:00: Back Shift
22:00 to 06:00: Night shift.
Fridays
0600 to 13:00 Day Shift
13:00 to 20:00 Back Shift
Sunday
23:00-0600: Night Shift
All other weekend times: OT.

Probably best to ignore the variances for fridays and weekends at the moment, unless it is easier to encorporate than I imagine?

In any case, it would be great to have some help!

Jon
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I should add that I have tried =IF(AND( formulas as well as =INDEX but neither have worked so far.

Help!
 
Upvote 0
I don't pretend to understand your time-frames and shift-naming system, so I might have this a bit wrong, and assuming you have a single time in each cell in column J (as opposed to a time range), then the following might work ...

in column O you could use ... =IF((TEXT(B2,"dddd"))="Friday",VLOOKUP(J2,$S$2:$T$4,2),IF((TEXT(B2,"dddd"))="Saturday",VLOOKUP(J2,$S$5:$T$5,2),IF((TEXT(B2,"dddd"))="Sunday",VLOOKUP(J2,$S$6:$T$8,2),VLOOKUP(J2,$S$9:$T$11,2))))

you'd need the following table in the range R2:T11 ...
Friday0:00Night Shift
6:00Day Shift
13:00Back Shift
Saturday0:00OT
Sunday0:00OT
23:00Night Shift
Weekday0:00Night Shift
6:00Day Shift
14:00Back Shift
22:00Night Shift

<tbody>
</tbody>


Even if there are errors in my understanding of your 'shift' system, you should be able to amend the table accordingly.

Kind regards,

Chris
 
Upvote 0
To my amazement- this worked perfectly, first time. Thank you very much!
 
Upvote 0

Forum statistics

Threads
1,215,427
Messages
6,124,830
Members
449,190
Latest member
rscraig11

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