#1   Report Post  
Posted to microsoft.public.excel.misc
mat mat is offline
external usenet poster
 
Posts: 37
Default Subtotal

Dear Mate,

I have data in colum A which has revenue on each row and a blank row after
every regular intervals but the row count is different in each row . I need
to put subtotal formuls in each blank row. For eg.

Col A
399.2
38.5
5.0
0.2
Subtotal (A1-A4)
0.3
Subtotal (A5)
0.3
Subtotal (A6)
9.2
2.2
0.8
0.3
0.1
0.1
0.1
Subtotal (A7-13)
5.2
0.5
Subtotal (A14-15)

Regards

mat

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 320
Default Subtotal

Select all the blank cells (or Select col A, then edit/goto/special, click
blanks). Once the "correct" cells are selected, simply single click the Sum
tool!
Bob Umlas
Excel MVP

"Mat" wrote:

Dear Mate,

I have data in colum A which has revenue on each row and a blank row after
every regular intervals but the row count is different in each row . I need
to put subtotal formuls in each blank row. For eg.

Col A
399.2
38.5
5.0
0.2
Subtotal (A1-A4)
0.3
Subtotal (A5)
0.3
Subtotal (A6)
9.2
2.2
0.8
0.3
0.1
0.1
0.1
Subtotal (A7-13)
5.2
0.5
Subtotal (A14-15)

Regards

mat

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Subtotal

Sub test()
Dim iLastRow As Long
Dim tmp
Dim i As Long
With ActiveSheet
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow + 1
If .Cells(i, "A").Value < "" Then
tmp = tmp + .Cells(i, "A").Value
Else
.Cells(i, "A").Value = tmp
tmp = 0
End If
Next i
End With

End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Mat" wrote in message
...
Dear Mate,

I have data in colum A which has revenue on each row and a blank row after
every regular intervals but the row count is different in each row . I
need
to put subtotal formuls in each blank row. For eg.

Col A
399.2
38.5
5.0
0.2
Subtotal (A1-A4)
0.3
Subtotal (A5)
0.3
Subtotal (A6)
9.2
2.2
0.8
0.3
0.1
0.1
0.1
Subtotal (A7-13)
5.2
0.5
Subtotal (A14-15)

Regards

mat



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 751
Default Subtotal

On Mar 6, 7:03 pm, Mat wrote:
Dear Mate,

I have data in colum A which has revenue on each row and a blank row after
every regular intervals but the row count is different in each row . I need
to put subtotal formuls in each blank row. For eg.

Col A
399.2
38.5
5.0
0.2
Subtotal (A1-A4)
0.3
Subtotal (A5)
0.3
Subtotal (A6)
9.2
2.2
0.8
0.3
0.1
0.1
0.1
Subtotal (A7-13)
5.2
0.5
Subtotal (A14-15)

Regards

mat


The following macro will do what you want if the sheet is active and
data is in column A:A

Sub FillSubtotals()
LastRow = Range("A65536").End(xlUp).Row
tempSum = 0
For i = 1 to LastRow
If Cells(i,"A") < "" Then
tempSum = tempSum + Cells(i,"A")
Else
Cells(i,"A") = tempSum
tempSum = 0
End If
Next i
End Sub

HTH
Kostis Vezerides

  #5   Report Post  
Posted to microsoft.public.excel.misc
mat mat is offline
external usenet poster
 
Posts: 37
Default Subtotal

Dear Bob,

Excellent. Job done.

Regards
Mat

"Bob Umlas, Excel MVP" wrote:

Select all the blank cells (or Select col A, then edit/goto/special, click
blanks). Once the "correct" cells are selected, simply single click the Sum
tool!
Bob Umlas
Excel MVP

"Mat" wrote:

Dear Mate,

I have data in colum A which has revenue on each row and a blank row after
every regular intervals but the row count is different in each row . I need
to put subtotal formuls in each blank row. For eg.

Col A
399.2
38.5
5.0
0.2
Subtotal (A1-A4)
0.3
Subtotal (A5)
0.3
Subtotal (A6)
9.2
2.2
0.8
0.3
0.1
0.1
0.1
Subtotal (A7-13)
5.2
0.5
Subtotal (A14-15)

Regards

mat

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
How do I Subtotal, then Sort by Subtotal Amounts? dnamertz Excel Discussion (Misc queries) 3 October 29th 06 12:17 AM
pasting to subtotal lines without replacing hidden -non-subtotal l harleydiva67 Excel Discussion (Misc queries) 1 October 12th 06 06:02 PM
Bolding the subtotal lines automaticlly When using the Subtotal fu 06Speed6 New Users to Excel 2 October 5th 06 03:52 PM
copy subtotal value only, subtotal value can be vlookup by others BB Excel Discussion (Misc queries) 1 June 28th 06 11:10 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 03:38 PM.

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"