ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find, Loop, Subtotal (https://www.excelbanter.com/excel-programming/315259-find-loop-subtotal.html)

Adresmith[_9_]

Find, Loop, Subtotal
 

I have a spreadsheet that calculates budgets. The rows that being wit
"52000" are totals. I need VBA that will loop through my spreadshee
and subtotal each column using the values adjacent to the totals. I
anyone can help I would greatly appreciate it!

Thanks, Adrianne

Cost Center Description 2005 Plan 2004 Forecast @ September Close
94200 HUMAN RESOURCES DEPARTMENT $400,636 $410,759
94230 EMPLOYMENT $186,299 $140,289
94250 ORGANIZATIONAL DEVELOPMENT $216,356 $218,593
94400 LABOR RELATIONS $127,307 $114,536
94700 SAFETY $108,942 $25,638
94650 COMPENSATION $135,107 $119,884
94600 TRAINING AND DEVELOPMENT $167,055 $146,795
52000100 STRAIGHT TIME REGULAR $1,341,702 $1,176,494
94400 LABOR RELATIONS $0 $0
52000800 HOLIDAY WORKED PREMIUM $0 $0
94200 HUMAN RESOURCES DEPARTMENT $0 $60

--
Adresmit
-----------------------------------------------------------------------
Adresmith's Profile: http://www.excelforum.com/member.php...nfo&userid=913
View this thread: http://www.excelforum.com/showthread.php?threadid=27373


Myrna Larson

Find, Loop, Subtotal
 
If you don't really need VBA, you can do this with SUMIF. Assuming the cost
centers are all numeric,

=SUMIF(A1:A200,"=52000000",C1:C200)

If you need VBA, you should be able to write the same thing there using

Set Rng1 = Range("A1:A200")
Set Rng2 = Rng1.Offset(0, 2)

X = Application.SUMIF(Rng1,"=52000000",Rng2)

On Fri, 29 Oct 2004 15:23:44 -0500, Adresmith
wrote:


I have a spreadsheet that calculates budgets. The rows that being with
"52000" are totals. I need VBA that will loop through my spreadsheet
and subtotal each column using the values adjacent to the totals. If
anyone can help I would greatly appreciate it!

Thanks, Adrianne

Cost Center Description 2005 Plan 2004 Forecast @ September Close
94200 HUMAN RESOURCES DEPARTMENT $400,636 $410,759
94230 EMPLOYMENT $186,299 $140,289
94250 ORGANIZATIONAL DEVELOPMENT $216,356 $218,593
94400 LABOR RELATIONS $127,307 $114,536
94700 SAFETY $108,942 $25,638
94650 COMPENSATION $135,107 $119,884
94600 TRAINING AND DEVELOPMENT $167,055 $146,795
52000100 STRAIGHT TIME REGULAR $1,341,702 $1,176,494
94400 LABOR RELATIONS $0 $0
52000800 HOLIDAY WORKED PREMIUM $0 $0
94200 HUMAN RESOURCES DEPARTMENT $0 $608




All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com