![]() |
If duplicate found sum column C
I have information in column A, B and C. If column A and B match then sum
the qty of the duplicates in column D. Can someone help with a formula that would accomplish this? Column A Column B Column C Column D Order Item Qty Sum of Duplicates 23580351 04827 5 23580351 04827 5 23580358 04827 5 23580361 04827 5 23580361 04827 5 23580368 04827 5 |
If duplicate found sum column C
Assumptions: First is that you meant to sum the duplicate rows rather than
columns, since your illustration does not indicate the probability of a match between column A and B. If this assumption is false, then the code fails. File is sorted by order number so that duplicates will be grouped. There are no more than two rows for any group of duplicates. If there are more than two then this macro fails. A different and more complex code must be used if there are more than two duplicates. Here is the code: Sub SumDupRow() lr = Cells(Rows.Count, 1).End(xlUp).Row Range("$A$1").Activate Do For i = 1 To lr x = ActiveCell.Address If Range(x).Value = Range(x).Offset(1, 0).Value And Range(x).Offset(0, 1).Value = Range(x).Offset(1, 1).Value Then Range(x).Offset(0, 3) = Range(x).Offset(0,2).Value + Range(x).Offset(1,2) End If Next i Range(x).Offset(1, 0).Activate Loop Until Range(x) = "" End Sub "Wasabijim" wrote: I have information in column A, B and C. If column A and B match then sum the qty of the duplicates in column D. Can someone help with a formula that would accomplish this? Column A Column B Column C Column D Order Item Qty Sum of Duplicates 23580351 04827 5 23580351 04827 5 23580358 04827 5 23580361 04827 5 23580361 04827 5 23580368 04827 5 |
All times are GMT +1. The time now is 09:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com