ThePangloss
New Member
- Joined
- Jun 19, 2015
- Messages
- 40
I'm looking for a way to add up the values of duplicate rows underneath the original then delete the duplicate afterwards, whether this is through VBA or just formulas. I can't really think of any way other than using the IF function such as
=IF((A2=A3)*(B2=B3),"",SUM(C$<wbr style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap;">2:C2)-SUM(D$1:D1))
but this only works for rows that have only one duplicate row. Some of my data has three to five duplicate rows with values that I need to sum up in the main one. The rows I have are last name, first name, id number, then hours worked. Some people worked different jobs at different periods so they come up multiple times. I need to add up their total hours.
An example looks like this
<tbody>
</tbody>
which I need to turn into
<tbody>
</tbody>
I'd appreciate any advice on this. Thanks in advance.
=IF((A2=A3)*(B2=B3),"",SUM(C$<wbr style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap;">2:C2)-SUM(D$1:D1))
but this only works for rows that have only one duplicate row. Some of my data has three to five duplicate rows with values that I need to sum up in the main one. The rows I have are last name, first name, id number, then hours worked. Some people worked different jobs at different periods so they come up multiple times. I need to add up their total hours.
An example looks like this
john doe | 128128 | 10 |
john doe | 128128 | 21 |
john doe | 128128 | 8 |
bob marley | 238281 | 10 |
jane doe | 91919 | 7 |
jane doe | 91919 | 10 |
mark john | 383282 | 20 |
<tbody>
</tbody>
which I need to turn into
john doe | 128128 | 39 |
bob marley | 238281 | 10 |
jane doe | 91919 | 17 |
mark john | 383282 | 20 |
<tbody>
</tbody>
I'd appreciate any advice on this. Thanks in advance.