Summarize Data
Yo could record a macro while generating the pivot table to get a macro. If
yo want a macro that doesn't generate a pivot table try this
Sub maketable()
RowCount = 1
Do While Range("A" & RowCount) < ""
If Range("A" & RowCount) = Range("A" & (RowCount + 1)) And _
Range("B" & RowCount) = Range("B" & (RowCount + 1)) Then
Range("C" & RowCount) = Range("C" & RowCount) + _
Range("C" & (RowCount + 1))
Range("D" & RowCount) = Range("D" & RowCount) + _
Range("D" & (RowCount + 1))
Rows(RowCount + 1).Delete
Else
RowCount = RowCount + 1
End If
Loop
End Sub
"joecrabtree" wrote:
All,
I am looking for a way to summarize data. The data format I have is as
follows (Although there could be more of it):
DATE CODE QUANTITY VALUE
01/01/09 ABC 10 1000
01/01/09 ABC 1 100
01/01/09 KDK 4 44
02/01/09 JDJ 2 13
02/01/09 JDJ 33 22
This data is in a worksheet called 'data'. I would like to summarize
this data as follows in a sheet called 'output':
DATE CODE QUANTITY VALUE
01/01/09 ABC 11 1100
01/01/09 KDK 4 44
02/01/09 JDJ 35 35
I.e. summarized by date and code,
Ive tried using pivot tables, but I would like to automate this using
VBA.
Any ideas?
Thanks
Joe
|