Forum Discussion
giriokamat
Sep 14, 2022Copper Contributor
Combining multiple excel sheets corresponding to name
Hello All,
Looking for some help here. I have a large excel sheet with multiple names that repeat - simplified version here. This is my Sheet 2
Name | Cat 1 | Cat 2 | Cat3 | Cat4 | Cat 5 | Cat 6 |
M10 | 0 | 0 | 0 | 0 | 0 | 0 |
M6 | 0 | 0 | 0 | 0 | 0 | 1 |
M6 | 0 | 0 | 0 | 0 | 0 | 1 |
M8 | 0 | 0 | 0 | 0 | 1 | 0 |
M9 | 0 | 1 | 0 | 0 | 0 | 0 |
M9 | 0 | 0 | 0 | 0 | 1 | 0 |
M10 | 1 | 0 | 3 | 0 | 6 | 0 |
M6 | 1 | 2 | 4 | 0 | 6 | 0 |
M6 | 1 | 2 | 4 | 0 | 6 | 0 |
M8 | 1 | 0 | 11 | 9 | 0 | 0 |
M8 | 1 | 0 | 3 | 3 | 0 | 0 |
M9 | 2 | 1 | 2 | 2 | 0 | 0 |
M10 | 0 | 1 | 0 | 0 | 0 | 0 |
M10 | 0 | 0 | 0 | 0 | 0 | 1 |
Sheet 1 is arranged in this fashion. It has the first occurrence of the names in sheet 2
M6 | 0 | 0 | 0 | 0 | 0 | 1 |
M8 | 0 | 0 | 0 | 0 | 1 | 0 |
M9 | 0 | 1 | 0 | 0 | 0 | 0 |
M10 | 0 | 0 | 0 | 0 | 0 | 0 |
I would like to use a code to automatically add the other occurrences added under the name category. Please note some repeat multiple times and some don't repeat at all.
Expected output:
Name | Cat 1 | Cat 2 | Cat3 | Cat4 | Cat 5 | Cat 6 |
M6 | 0 | 0 | 0 | 0 | 0 | 1 |
M6 | 0 | 0 | 0 | 0 | 0 | 1 |
M6 | 1 | 2 | 4 | 0 | 6 | 0 |
M6 | 1 | 2 | 4 | 0 | 6 | 0 |
M8 | 0 | 0 | 0 | 0 | 1 | 0 |
M8 | 1 | 0 | 11 | 9 | 0 | 0 |
M8 | 1 | 0 | 3 | 3 | 0 | 0 |
M9 | 0 | 1 | 0 | 0 | 0 | 0 |
M9 | 0 | 0 | 0 | 0 | 1 | 0 |
M9 | 2 | 1 | 2 | 2 | 0 | 0 |
M10 | 0 | 0 | 0 | 0 | 0 | 0 |
M10 | 1 | 0 | 3 | 0 | 6 | 0 |
M10 | 0 | 1 | 0 | 0 | 0 | 0 |
M10 | 0 | 0 | 0 | 0 | 0 | 1 |
1 Reply
- Harun24HRBronze Contributor