Have a look at the table at cell AE1 of the attached.
There are some 2s in the table but that's because you have, for example, employee C working the night shift twice on the same date (rows 10 and 16 of your source data).
If this is more or less what you want then it will need tidying up and shortening because the way I've done it just happens to be what I first got to work.
(I've hidden columns F:AC, your current results.)
|