If statement with Date & time

shonaart

Board Regular
Joined
Nov 1, 2004
Messages
214
Hi
Please could you help

Column A : Date & time ( 23 march 2011 14:35 )

In column B: I want the formula to look at column A and return three possible asnswers.

If the time is between 06:00 to 13:59 = AM shift
If the time is between 14:00 to 21:59 = PM Shift
If the time is between 22:00 to 06:00 = Night Shift.

Remember there is a dat attached to the time. I do not want to split the date & time pls.

Thanks
Vaughan
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
HI Peter_SSS
Thanks for all the help in the past.
Is it possible to do the the above formula without adding other Columns, one that looks at the date and time and returns the answer ?

Thanks
 
Upvote 0
Is it possible to do the the above formula without adding other Columns, one that looks at the date and time and returns the answer ?
Yes, except that you had mentioned the issue of public holidays being treated as a weekend day. My previous suggestion did cover that case. If we don't have a list of public holidays, we cannot allow for them.

The formula in column B below uses no helper columns but gives incorrect results in B11 and B13 given the dates and public holidays shown (same as I used in post #9).

If you at least allow a list of public holidays, then the formula in column C should work for those too.

Excel Workbook
ABCD
1Date/TimeShiftShiftPublic Holidays
2Wed 23/03/11 14:35PMPMMon 28/03/11
3Wed 23/03/11 19:37PMPMFri 27/05/11
4Thu 24/03/11 0:39NightNight
5Thu 24/03/11 5:42NightNight
6Thu 24/03/11 10:44AMAM
7Thu 24/03/11 15:47PMPM
8Sat 26/03/11 5:42PMPM
9Sat 26/03/11 10:44AMAM
10Sat 26/03/11 15:47AMAM
11Mon 28/03/11 5:42NightPM
12Mon 28/03/11 10:44AMAM
13Mon 28/03/11 22:47NightPM
14Tue 29/03/11 22:47NightNight
15
Shift
 
Upvote 0
HI Peter, thanks so much.
I am going to ignore the public holidays. But the weekends are important. I do the publice holidays manually if I need to.
Thanks so much for your time.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,754
Members
452,940
Latest member
rootytrip

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