Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Duplicate Row for data found in columns | Excel Discussion (Misc queries) | |||
If text found in Row, delete Column | Excel Programming | |||
How to find a row since I found a value in a column? see example | Excel Worksheet Functions | |||
URGENT -- search in string for a value in another column, if found, return value from next column | Excel Programming | |||
A problem with found a value on a column | Excel Programming |