Hello,
I am working on a project where I need to split hours between departments. So for example if a shift was done from 7am to 7pm it would be coded to the department in Department 1 (column A). If it was worked from 7pm to 7am it would be coded to the department in Department 2 (column B). If there was an overlap then I want it to say "Split".
Normally I am quite good with If statements but I can't get this one to work. I'm not able to attach a sample of my document but I can describe the layout:
[TABLE="width: 295"]
<TBODY>[TR]
[TD]Shift Day</SPAN>
[/TD]
[TD]Day
Start</SPAN>
[/TD]
[TD]Day Finish</SPAN>
[/TD]
[TD]Department
[/TD]
[/TR]
[TR]
[TD]0700-1900</SPAN>
[/TD]
[TD]0700</SPAN>
[/TD]
[TD]1900</SPAN>
[/TD]
[TD]A</SPAN>
[/TD]
[/TR]
[TR]
[TD]1000-2200</SPAN>
[/TD]
[TD]1000</SPAN>
[/TD]
[TD]2200</SPAN>
[/TD]
[TD]Split</SPAN>
[/TD]
[/TR]
[TR]
[TD]0800-2000</SPAN>
[/TD]
[TD]0800</SPAN>
[/TD]
[TD]2000</SPAN>
[/TD]
[TD]Split</SPAN>
[/TD]
[/TR]
[TR]
[TD]0700-1900</SPAN>
[/TD]
[TD]0700</SPAN>
[/TD]
[TD]1900</SPAN>
[/TD]
[TD]A</SPAN>
[/TD]
[/TR]
[TR]
[TD]1500-0300</SPAN>
[/TD]
[TD]1500</SPAN>
[/TD]
[TD]0300</SPAN>
[/TD]
[TD]B</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
As you can see the first four rows of data are correct. But I keep getting errors with ones similar to the last one, which should show as "Split".
My formula at the moment is:
=IF(AND(K2>="0700",L2<="1900",K2<"1900",L2>"0700",L2<>"0000"),H2,IF(OR(AND(K2>="1900",L2<="0700"),AND(K2>="1900",L2<="2400"),AND(K2>="1900",L2="0000"),AND(K2>"0000",L2<"0700")),I2,IF(OR(AND(K2<"0700",L2>"0700"),AND(L2>"1900",K2>"0700"),AND(K2<"1900",L2>="0000",L2<"0700")),"Split","")))
Where K is the "Day Start" column, L is the "Day Finish" column", column H is the department for the early shift and column I is the department for the night shift.
if anyone could help with this or tell me where I am going wrong then I would be really grateful. Also, I realise the formula is quite complex so if there's a simpler method of doing it that would be great.
Thanks,
Miran
[TABLE="width: 95"]
<TBODY>[TR]
[TD]</SPAN>
[/TD]
[/TR]
[TR]
[TD]</SPAN>
[/TD]
[/TR]
[TR]
[TD]</SPAN>
[/TD]
[/TR]
[TR]
[TD]</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
I am working on a project where I need to split hours between departments. So for example if a shift was done from 7am to 7pm it would be coded to the department in Department 1 (column A). If it was worked from 7pm to 7am it would be coded to the department in Department 2 (column B). If there was an overlap then I want it to say "Split".
Normally I am quite good with If statements but I can't get this one to work. I'm not able to attach a sample of my document but I can describe the layout:
[TABLE="width: 295"]
<TBODY>[TR]
[TD]Shift Day</SPAN>
[/TD]
[TD]Day
Start</SPAN>
[/TD]
[TD]Day Finish</SPAN>
[/TD]
[TD]Department
[/TD]
[/TR]
[TR]
[TD]0700-1900</SPAN>
[/TD]
[TD]0700</SPAN>
[/TD]
[TD]1900</SPAN>
[/TD]
[TD]A</SPAN>
[/TD]
[/TR]
[TR]
[TD]1000-2200</SPAN>
[/TD]
[TD]1000</SPAN>
[/TD]
[TD]2200</SPAN>
[/TD]
[TD]Split</SPAN>
[/TD]
[/TR]
[TR]
[TD]0800-2000</SPAN>
[/TD]
[TD]0800</SPAN>
[/TD]
[TD]2000</SPAN>
[/TD]
[TD]Split</SPAN>
[/TD]
[/TR]
[TR]
[TD]0700-1900</SPAN>
[/TD]
[TD]0700</SPAN>
[/TD]
[TD]1900</SPAN>
[/TD]
[TD]A</SPAN>
[/TD]
[/TR]
[TR]
[TD]1500-0300</SPAN>
[/TD]
[TD]1500</SPAN>
[/TD]
[TD]0300</SPAN>
[/TD]
[TD]B</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
As you can see the first four rows of data are correct. But I keep getting errors with ones similar to the last one, which should show as "Split".
My formula at the moment is:
=IF(AND(K2>="0700",L2<="1900",K2<"1900",L2>"0700",L2<>"0000"),H2,IF(OR(AND(K2>="1900",L2<="0700"),AND(K2>="1900",L2<="2400"),AND(K2>="1900",L2="0000"),AND(K2>"0000",L2<"0700")),I2,IF(OR(AND(K2<"0700",L2>"0700"),AND(L2>"1900",K2>"0700"),AND(K2<"1900",L2>="0000",L2<"0700")),"Split","")))
Where K is the "Day Start" column, L is the "Day Finish" column", column H is the department for the early shift and column I is the department for the night shift.
if anyone could help with this or tell me where I am going wrong then I would be really grateful. Also, I realise the formula is quite complex so if there's a simpler method of doing it that would be great.
Thanks,
Miran
[TABLE="width: 95"]
<TBODY>[TR]
[TD]</SPAN>
[/TD]
[/TR]
[TR]
[TD]</SPAN>
[/TD]
[/TR]
[TR]
[TD]</SPAN>
[/TD]
[/TR]
[TR]
[TD]</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]