Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Row for data found in columns JC Excel Discussion (Misc queries) 0 June 30th 08 05:09 PM
If text found in Row, delete Column JEFF Excel Programming 4 April 29th 07 10:24 PM
How to find a row since I found a value in a column? see example [email protected] Excel Worksheet Functions 1 April 25th 06 05:45 PM
URGENT -- search in string for a value in another column, if found, return value from next column samkshah Excel Programming 4 October 3rd 05 04:13 PM
A problem with found a value on a column Iceman Solope Excel Programming 7 September 6th 04 08:12 PM


All times are GMT +1. The time now is 06:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"