View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Search Column - Find Multiple Entries - Sum Then Delete to Single

Why not just use a pivot table? It will do all of that for you and more...
--
HTH...

Jim Thomlinson


"Ledge" wrote:

Hi Folks, Hoping I could get some guidance with this:

I have 3 columns of data on sheet1.

Column A is numerical "APN"
Column B is text "Product Description"
Column C is numerical "Total"

Is there a way to search column A for multiple matching entries and if
so to sum the total while reducing back to one entry?

EG: SHEET CURRENTLY LOOKS LIKE THIS

APN Product Description Total
25454 AAA 2
32121 BBB 1
32654 CCC 2
25454 AAA 5

WOULD LIKE IT TO DO THIS

APN Product Description Total
25454 AAA 7
32121 BBB 1
32654 CCC 2

The code below detects the multiple entries in Column A but I need to
then Sum the values in Column C then delete/hide thus reducing the
multiple entries back to a single entry.

This one is beyond my skills and would appreciate any assistance.

Hope this makes sense

Thanks for your time.

Dean


Sub Macro2()

Dim wks As Worksheet
Dim rng As Range

Set wks = ActiveSheet
Set rng = wks.Cells

rng.Sort Key1:=wks.Range("A1"), Order1:=xlAscending, Header:=xlNo
Set rng = wks.Range("A65535").End(xlUp)
Do While rng.Row 1
Set rng = rng.Offset(-1, 0)
If rng.Offset(1, 0).Value = rng.Value Then ????????????????

Loop
Set wks = Nothings
Set rng = Nothing

End Sub