I am limited to using Excel 2016. I know in Python I can achieve this very easily, but looking for a solution to make my life easier. I have a fairly large dataset which -generally- looks like the table below (the real dataset also broken into 3 shifts, but I have simplified it a bit):
Notes on the dataset
- The shift managers are consistent about recording data with a "/" character when they do a product changeover in the Product and Output columns.
- The shift managers are consistent in using a "/" character to show which employees worked on which machines
- Employees can and do work across machines in the same shift.
- There are never more than 3 employees on 1 machine
- There are never more than 2 products on each shift
Example raw data
| Date | Machine No. | Product | Output | Employees |
|---|---|---|---|---|
| 01-Aug-2022 | 1 | ABC | 3,100,100 | BOB/JON |
| 01-Aug-2022 | 2 | DCE | 2,300,000 | BOB/CATH/AMY |
| 01-Aug-2022 | 3 | EFG | 4,500,6000 | ZEE/IAN/GAZ |
| 02-Aug-2022 | 1 | ABC/HIJ | 1,100,100/900,000 | BOB/JON |
| 02-Aug-2022 | 2 | DCE | 2,300,000 | AMY |
| 02-Aug-2022 | 3 | EFG | 4,500,6000 | ZEE/IAN/GAZ |
| 03-Aug-2022 | 1 | HIJ/LMN | 1,100,100/1,900,000 | BOB |
| 03-Aug-2022 | 2 | DCE | 2,300,000 | GAZ |
| 03-Aug-2022 | 3 | EFG/PQR | 1,500,600/1,700,000 | ZEE/IAN/JON |
What I have done so far...
I can use the "Text to Data" function in Excel, using the "/" character as a delimiter, to create new columns, which results in something like this:
| Date | Machine No. | Product1 | Product2 | Output1 | Output2 | Employee1 | Employee2 | Employee3 |
|---|---|---|---|---|---|---|---|---|
| 01/Aug/2022 | 1 | ABC | 3,100,100 | BOB | JON | |||
| 01/Aug/2022 | 2 | DCE | 2,300,000 | BOB | CATH | AMY | ||
| 01/Aug/2022 | 3 | EFG | 4,500,6000 | ZEE | IAN | GAZ | ||
| 02/Aug/2022 | 1 | ABC | HIJ | 1,100,100 | 900,000 | BOB | JON | |
| 02/Aug/2022 | 2 | DCE | 2,300,000 | AMY | ||||
| 02/Aug/2022 | 3 | EFG | 4,500,6000 | ZEE | IAN | GAZ | ||
| 03/Aug/2022 | 1 | HIJ | LMN | 1,100,100 | 1,900,000 | BOB | ||
| 03/Aug/2022 | 2 | DCE | 2,300,000 | GAZ | ||||
| 03/Aug/2022 | 3 | EFG | PQR | 1,500,600 | 1,700,000 | ZEE | IAN | JON |
What I want to achieve...
My ideal output would be the following:
- When there are product changeovers on a shift, I would like the additional columns to be reintegrated back into the table, (as below)
- I want to count the number of unique employees for each shift. I currenlty have a formula to count this,
=SUMPRODUCT(($AJ$48:$AL$56<>"")/COUNTIF($AJ$48:$AL$56,$AJ$48:$AL$56&""), but I have to manually update the formula for every shift.
| Date | Machine No. | Product | Output | Employee1 | Employee2 | Employee3 | Total Employees |
|---|---|---|---|---|---|---|---|
| 01/Aug/2022 | 1 | ABC | 3,100,100 | BOB | JON | 7 | |
| 01/Aug/2022 | 2 | DCE | 2,300,000 | BOB | CATH | AMY | 7 |
| 01/Aug/2022 | 3 | EFG | 4,500,6000 | ZEE | IAN | GAZ | 7 |
| 02/Aug/2022 | 1 | ABC | 1,100,100 | BOB | JON | 6 | |
| 02/Aug/2022 | 1 | HIJ | 900,000 | BOB | JON | 6 | |
| 02/Aug/2022 | 2 | DCE | 2,300,000 | AMY | 6 | ||
| 02/Aug/2022 | 3 | EFG | 4,500,6000 | ZEE | IAN | GAZ | 6 |
| 03/Aug/2022 | 1 | HIJ | 1,100,100 | BOB | 5 | ||
| 03/Aug/2022 | 1 | LMN | 1,900,000 | BOB | 5 | ||
| 03/Aug/2022 | 2 | DCE | 2,300,000 | GAZ | 5 | ||
| 03/Aug/2022 | 3 | EFG | 1,500,600 | ZEE | IAN | JON | 5 |
| 03/Aug/2022 | 3 | PQR | 1,700,000 | ZEE | IAN | JON | 5 |

