a totals sheet

FireStrike

Registered User.
Local time
Today, 07:00
Joined
Jul 14, 2006
Messages
69
here is a description of my excel file.

there are 12 worksheets, each representing a month.
each of these worksheets has 3 columns
branch, customer_no, price

I have a 13th worksheet for totals.

I need to get the total price for each month/branch/custom.

example output
month branch customer total_price
july 1 1 5.00
july 2 1 3.00
july 2 2 10.00
june 2 2 6.00

and so on. Does anyone know of an easy way to do something like this? If not can someone kinda point me in the right direction of the hard way to do this?
 
Howdy. If they are laid out exactly, then you can use this approach. Insert two more worksheets: labeled First and Last (don't put anything on either of these). Move the First worksheet prior to the months, and the Last worksheet after the months. Make sure your Summary worksheet is either before First, or after Last. Then to get totals on the Summary worksheet, use something like this:

=SUM(First:Last!A2)

Or is there something more that you would want?
________
WASHINGTON MARIJUANA DISPENSARIES
 
Last edited:
I apologize, but i do not follow you:( I have figured out how to use code, on the activate event. I will have to put it to a button or something, but for now this is a start.

Dim I, J As Long
Dim lngBranch, lngCust As Long
Dim dblTotalPrice As Double
Dim strCurrent, strMonth As String

strCurrent = "estockjuly"
strMonth = "July 06"
I = 2
J = 2
lngCust = Worksheets(strCurrent).[e2]
lngBranch = Worksheets(strCurrent).[d2]
Worksheets("totals").[b2] = Worksheets(strCurrent).[d2]
dblTotalPrice = 0
While Worksheets(strCurrent).Cells(I, 4).Value <> ""
dblTotalPrice = dblTotalPrice + Val(Worksheets(strCurrent).Cells(I, 13).Value)
If Val(Worksheets(strCurrent).Cells(I, 4).Value) <> lngBranch Or Val(Worksheets(strCurrent).Cells(I, 5)) <> lngCust Then
lngBranch = Worksheets(strCurrent).Cells(I, 4).Value
lngCust = Worksheets(strCurrent).Cells(I, 5).Value
Worksheets("Totals").Cells(J, 1).Value = strMonth
Worksheets("Totals").Cells(J, 2).Value = lngBranch
Worksheets("Totals").Cells(J, 3).Value = lngCust
Worksheets("Totals").Cells(J, 4).Value = dblTotalPrice
dblTotalPrice = 0
J = J + 1
End If

I = I + 1
Wend

This is only for one month, now I need to do it for the other 11, but at least this will give me the results I need. If you know a fast/easier way please let me know.
 

Users who are viewing this thread

Back
Top Bottom