Time vs. shift

scolodny

New Member
Joined
Jan 29, 2004
Messages
4
I am pulling in data to my spreadsheet from an external source. I have used NOW() and defined its format as military time. I am wanting to determine, based on that time, what shift I am currently in. Shifts are 7 - 2, 2 - 11, and 11 to 7. I have been playing this for awhile with no luck. Can anyone provide a resolution?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Here's one way to accomplish what you want:
Change the cell where you have NOW() formatted as military time to =TIME(HOUR(NOW()),MINUTE(NOW()),0) and define this cell as TEST.
Create four defined Names as follows:
ATIME defined as =TIME(19,0,0)
BTIME defined as =TIME(2,0,0)
CTIME defined as =TIME(11,0,0)

In the cell where you want the shift to be displayed enter this formula:
=IF(OR(test>atime,test<=btime),"Shift A",IF(AND(test>btime,test<=ctime),"Shift B","Shift C"))

This assumes that the shift begins after 7:00 and ends on or before 2:00 (14:00).

Hope this helps,
Gary
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,025
Members
448,939
Latest member
Leon Leenders

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