
Signature
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
Don, thanks for your response, but it confuses me.
In my example, I do have some account numbers that will be the same, so I
can identify them. My issue comes in where there are five user defined
account numbers (which may be the same as the hard coded numbers). Those
user defined account numbers are entered into a column and my table picks
them up from a formula such as "=c4" (where c4 is the cell the user enters
the account number).
Does that help clarify my original question?
Thanks for your help. I do appreciate it.
> try using sumproduct idea
> =sumproduct((a2:a200="0001")*(b2:b200=1100)*c2:c200)
[quoted text clipped - 37 lines]
> >
> > Thanks for your help!
jlepack - 20 Nov 2006 21:09 GMT
Frank,
Try this macro. If anyone else could tell me a way to do away with the
LETTERS, then I would be appreciative. I'm just getting back to Excel
after a few years without it.
Public Sub TotalsOfPivotTable()
Dim wsin As Worksheet, wsout As Worksheet
Dim iProjLoop As Integer, iAccoLoop As Integer, x As Integer
Dim dValue As Double
Dim proj As String, acco As String
Dim bFound As Boolean
Const LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Set wsin = Sheets("yourSheetNameHere")
Set wsout = Sheets.Add
With wsout
.Name = "Output"
.Range("A1").Value = "Project"
.Range("B1").Value = "Account"
.Range("C1").Value = "Amount"
End With
Application.ScreenUpdating = False
wsin.Select
For iProjLoop = 2 To ActiveSheet.UsedRange.Rows.Count
proj = Range("A" & iProjLoop).Value
For iAccoLoop = 2 To ActiveSheet.UsedRange.Columns.Count
acco = Range(Mid(LETTERS, iAccoLoop, 1) & "1").Value
If Not acco = "" Then
dValue = Range(Mid(LETTERS, iAccoLoop, 1) &
iProjLoop).Value
If Not dValue = 0 Then
wsout.Select
bFound = False
For x = 2 To ActiveSheet.UsedRange.Rows.Count
If Range("A" & x).Value = proj And Range("B" &
x).Value = acco Then
Range("C" & x).Value = Range("C" & x).Value
+ dValue
bFound = True
End If
Next x
If Not bFound Then
x = ActiveSheet.UsedRange.Rows.Count + 1
Range("A" & x).Value = proj
Range("B" & x).Value = acco
Range("C" & x).Value = dValue
End If
wsin.Select
End If
End If
Next iAccoLoop
Next iProjLoop
Application.ScreenUpdating = True
End Sub
> Don, thanks for your response, but it confuses me.
>
[quoted text clipped - 54 lines]
> > >
> > > Thanks for your help!
Don Guillett - 20 Nov 2006 22:34 GMT
Then just change to c4
sumproduct((a2:a200="0001")*(b2:b200=c4)*c2:c200)

Signature
Don Guillett
SalesAid Software
dguillett1@austin.rr.com
> Don, thanks for your response, but it confuses me.
>
[quoted text clipped - 56 lines]
>> >
>> > Thanks for your help!