Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Subtotal and running/cumulative total!


Loacation Name Sales Comm
252 ABC 100 12.5
252 CCC 100 12.5
252 DDD 100 12.5
300 EEE 100 12.5
300 FFF 100 12.5
500 GGG 100 12.5
500 HHH 100 12.5
500 KKK 100 12.5

This is the data I got from external databae query. Is there any VBA
code to add subtotal and also running total in the rows after evr
location number changes. I mean, If I run the vba macro It will inser
two rows after every location changes. One row for subtotal for th
each locaion and in the next row will be the cumulative totals for al
location upto that point.:eek

--
rahul2
-----------------------------------------------------------------------
rahul25's Profile: http://www.excelforum.com/member.php...fo&userid=2889
View this thread: http://www.excelforum.com/showthread.php?threadid=49446

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Subtotal and running/cumulative total!

Public Sub Get_Totals()

Dim rw As Long
Dim total As Double
rw = 2
Do Until Cells(rw, "A") = ""
If Cells(rw, "A") = Cells(rw + 1, "A") Then
total = total + Cells(rw, "D")
Else
Cells(rw, "E") = total + Cells(rw, "D")
total = 0
End If
rw = rw + 1
Loop
End Sub


"rahul25" wrote:


Loacation Name Sales Comm
252 ABC 100 12.5
252 CCC 100 12.5
252 DDD 100 12.5
300 EEE 100 12.5
300 FFF 100 12.5
500 GGG 100 12.5
500 HHH 100 12.5
500 KKK 100 12.5

This is the data I got from external databae query. Is there any VBA
code to add subtotal and also running total in the rows after evry
location number changes. I mean, If I run the vba macro It will insert
two rows after every location changes. One row for subtotal for the
each locaion and in the next row will be the cumulative totals for all
location upto that point.


--
rahul25
------------------------------------------------------------------------
rahul25's Profile: http://www.excelforum.com/member.php...o&userid=28899
View this thread: http://www.excelforum.com/showthread...hreadid=494469


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cumulative total George Excel Discussion (Misc queries) 4 October 27th 06 02:20 PM
cumulative total dfisherkern New Users to Excel 1 February 17th 06 05:14 AM
Cumulative total Jesse Excel Programming 0 March 28th 05 06:21 PM
CUMULATIVE TOTAL Norm Excel Worksheet Functions 1 February 3rd 05 03:30 PM
Subtotal of Subtotal displays Grand Total in wrong row Thomas Born Excel Worksheet Functions 5 January 6th 05 01:46 PM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"