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:
<TBODY>
</TBODY>
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
<TBODY>
</TBODY>
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:
Shift Day</SPAN> | Day Start</SPAN> | Day Finish</SPAN> | Department |
0700-1900</SPAN> | 0700</SPAN> | 1900</SPAN> | A</SPAN> |
1000-2200</SPAN> | 1000</SPAN> | 2200</SPAN> | Split</SPAN> |
0800-2000</SPAN> | 0800</SPAN> | 2000</SPAN> | Split</SPAN> |
0700-1900</SPAN> | 0700</SPAN> | 1900</SPAN> | A</SPAN> |
1500-0300</SPAN> | 1500</SPAN> | 0300</SPAN> | B</SPAN> |
<TBODY>
</TBODY>
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
</SPAN> |
</SPAN> |
</SPAN> |
</SPAN> |
<TBODY>
</TBODY>