Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Sum a table of columns & rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Costa - 20 Nov 2006 16:21 GMT
I have a spreadsheet of 154 Rows (all unique project numbers in numerical
order) and 9 columns of account numbers (some are similiar and some are user
entered, therefore there could be 'blanks' with no data in them).  

I am trying to create a table that will only give me the project number if
there are dollars in one or more of the columns.  This would be used for data
entry (and that is why I would like to have the columns summed up - to remove
duplicates).

Any ideas?  I have given a brief example below:
                                                                F, G, & H
are User Defined Cols
    A                B          C         D         E      F           G    
      H  
1   Project #    1100   1111    1100    1100  "Blank"   4233     1111
2   00001       $50.00  $25.00  $3.00   $1.00              $25.00  $10.00
3   10000                    $5.00                                     $
5.00  $10.00
4   25000      $50.00   $10.00                                    $1.00  

What I would like to see is a table of the summarized data below:

Project   Account    Amount
00001     1100       $54.00
00001     1111       $35.00
00001     4233       $25.00
10000     1111       $15.00
10000     4233       $  5.00
25000     1100       $50.00
25000     1111       $10.00
25000     4233       $ 1.00            

Is this something that I can create using a pivot table and if so, how?

Thanks for your help!
Don Guillett - 20 Nov 2006 17:19 GMT
try using sumproduct idea
=sumproduct((a2:a200="0001")*(b2:b200=1100)*c2:c200)

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

>I have a spreadsheet of 154 Rows (all unique project numbers in numerical
> order) and 9 columns of account numbers (some are similiar and some are
[quoted text clipped - 34 lines]
>
> Thanks for your help!
Frank Costa - 20 Nov 2006 20:07 GMT
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!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.