Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Adding Duplicates

I have data in 3 columns. I want to remove the duplicate line but add the
quantities. Any quick way?

I have something like this :

Client Item Qty
yyyy I256 10
xxxx I124 20
yyyy I256 10

I want :

Client Item Qty
yyyy I256 20
xxxx I124 20


Thanks

TD


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Adding Duplicates

Using a Pivot Table seems appropiate to me.

--
Regards

Juan Pablo González

"Tyler D." wrote in message
...
I have data in 3 columns. I want to remove the duplicate line but add the
quantities. Any quick way?

I have something like this :

Client Item Qty
yyyy I256 10
xxxx I124 20
yyyy I256 10

I want :

Client Item Qty
yyyy I256 20
xxxx I124 20


Thanks

TD




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Adding Duplicates

Tyler,

Option Explicit
Sub TEST()

Dim S_1 As Worksheet
Dim S_2 As Worksheet
Dim R As Long
Dim str_F As String

Set S_1 = Worksheets("Data")
Set S_2 = Worksheets("Summary")

R = S_1.Cells(Rows.Count, 1).End(xlUp).Row
If R < 2 Then GoTo e:

S_2.Range("A:C").Clear
S_1.Range("A1:C" & R).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=S_2.Range("A1"), _
Unique:=True

str_F = "(__!$A$2:$A$~~&__!$B$2:$B$~~=A2&B2)*__!$C$2:$C$~~ )"
str_F = "=SUMPRODUCT(" & str_F
str_F = Application.Substitute(str_F, "__", S_1.Name)
str_F = Application.Substitute(str_F, "~~", R)

R = S_2.Cells(Rows.Count, 1).End(xlUp).Row
If R < 2 Then GoTo e:

str_F = Application.Substitute(str_F, "~~", R)

With S_2.Range("C2:C" & R)
.Formula = str_F
.Value = .Value
End With

e:
Application.ScreenUpdating = True

End Sub


--
Regards,
Soo Cheon Jheong
Seoul, Korea
_ _
^¢¯^
--


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Adding Duplicates

(Updated)

Option Explicit
Sub TEST()

Dim S_1 As Worksheet
Dim S_2 As Worksheet
Dim R As Long
Dim str_F As String

Set S_1 = Worksheets("Data")
Set S_2 = Worksheets("Summary")

R = S_1.Cells(Rows.Count, 1).End(xlUp).Row
If R < 2 Then GoTo e:

S_2.Range("A:C").Clear
S_1.Range("A1:C" & R).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=S_2.Range("A1"), _
Unique:=True

str_F = "(__!$A$2:$A$~~&__!$B$2:$B$~~=A2&B2)*__!$C$2:$C$~~ )"
str_F = "=SUMPRODUCT(" & str_F
str_F = Application.Substitute(str_F, "__", S_1.Name)
str_F = Application.Substitute(str_F, "~~", R)

R = S_2.Cells(Rows.Count, 1).End(xlUp).Row
If R < 2 Then GoTo e:

With S_2.Range("C2:C" & R)
.Formula = str_F
.Value = .Value
End With

e:
Application.ScreenUpdating = True

End Sub


--
Regards,
Soo Cheon Jheong
Seoul, Korea
_ _
^¢¯^
--


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Adding Duplicates

Thx Guys

TD

"Tyler D." wrote in message
...
I have data in 3 columns. I want to remove the duplicate line but add the
quantities. Any quick way?

I have something like this :

Client Item Qty
yyyy I256 10
xxxx I124 20
yyyy I256 10

I want :

Client Item Qty
yyyy I256 20
xxxx I124 20


Thanks

TD




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
Duplicates Dias[_2_] Excel Worksheet Functions 7 February 10th 09 01:45 AM
Condensing a list with duplicates to a list with non-duplicates Nuclear Excel Worksheet Functions 2 July 29th 08 08:03 PM
Adding duplicates... accountant Excel Worksheet Functions 1 July 23rd 08 10:40 PM
Duplicates in excel that aren't 100% DUPLICATES ... [email protected] Excel Discussion (Misc queries) 4 May 2nd 08 06:43 PM
Adding new numbers as I type without duplicates from Sheet1,ColumnA to Sheet2,ColumnA Master Excel Worksheet Functions 2 July 12th 05 05:03 PM


All times are GMT +1. The time now is 11:38 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"