Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
max max is offline
external usenet poster
 
Posts: 12
Default Conditional totals

HELP! I am trying to loop thorugh all the worksheets in a book and count the value of a cell if a coreesponding cell matches the desired value. I then want to report the sheet totals on a summary sheet
PROBLEM: I can separate & differentiate which total comes from which sheet
Here what I tried

Sub mv(
v1 = "sale
For z = 1 To (Sheets("NT").UsedRange.SpecialCells(xlLastCell).R ow
For y = 1 To Worksheets.Coun
For Each s In Sheet
x =
If s.Cells(z, 6) = v1 Then x = x + s.Cells(z, 4
Cells(y, 1) =
Nex
Next
Next
End Su

Grateful for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Conditional totals

Hi
and where do you want to put these worksheet names?. You may use
s.name
to get the name of the processed worksheet

--
Regards
Frank Kabel
Frankfurt, Germany


MAx wrote:
HELP! I am trying to loop thorugh all the worksheets in a book and
count the value of a cell if a coreesponding cell matches the desired
value. I then want to report the sheet totals on a summary sheet.
PROBLEM: I can separate & differentiate which total comes from which
sheet.
Here what I tried:

Sub mv()
v1 = "sale"
For z = 1 To (Sheets("NT").UsedRange.SpecialCells(xlLastCell).R ow)
For y = 1 To Worksheets.Count
For Each s In Sheets
x = 0
If s.Cells(z, 6) = v1 Then x = x + s.Cells(z, 4)
Cells(y, 1) = x
Next
Next y
Next z
End Sub

Grateful for any help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
max max is offline
external usenet poster
 
Posts: 12
Default Conditional totals

Frank,

The dersired summary result will look like this (e.g):
Sheet Total
N 100
NE 400
E 20
SE 20
S 25
SW 60
W 420
NW 800
where the sheet is the sheet name and the total is as specified in the earlier post.

TIA
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Conditional totals

Hi
not quite sure if this will work for you but try:
Sub mv()
v1 = "sale"
For z = 1 To (Sheets("NT").UsedRange.SpecialCells(xlLastCell).R ow)
For y = 1 To Worksheets.Count
For Each s In Sheets
x = 0
If s.Cells(z, 6) = v1 Then x = x + s.Cells(z, 4)
Cells(y, 1).Value = s.Name
Cells(y, 2).Value = x
Next
Next y
Next z
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


Max wrote:
Frank,

The dersired summary result will look like this (e.g):
Sheet Total
N 100
NE 400
E 20
SE 20
S 25
SW 60
W 420
NW 800
where the sheet is the sheet name and the total is as specified in
the earlier post.

TIA

  #5   Report Post  
Posted to microsoft.public.excel.programming
max max is offline
external usenet poster
 
Posts: 12
Default Conditional totals

Got there in the end
Sub mv(
v1 = "Sale
y =
ss = Worksheets.Coun
For s = 1 To s
y = y +
x =
For z = 1 To (Sheets(s).UsedRange.SpecialCells(xlLastCell).Row
If Sheets(s).Cells(z, 6) = v1 Then x = x + Sheets(s).Cells(z, 4
Sheets("test").Cells(y, 1).Value = Sheets(s).Nam
Sheets("test").Cells(y, 2).Value =
Next
Next
End Su

Thanks
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
Pivot Totals: Group totals different from Grand totals PsyberFox Excel Discussion (Misc queries) 1 February 13th 08 06:16 PM
how to enter totals and sub totals from receipts into excel. mjd23 New Users to Excel 2 January 11th 08 01:54 AM
Summing Weekly Totals into Monthly Totals steph44haf Excel Worksheet Functions 3 July 5th 06 04:51 PM
How do I sum YTD totals based on monthly totals Bsgrad02 Excel Discussion (Misc queries) 3 July 12th 05 04:59 PM
Comparing/matching totals in a column to totals in a row Nicole L. Excel Worksheet Functions 3 January 27th 05 10:42 PM


All times are GMT +1. The time now is 02:56 PM.

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

About Us

"It's about Microsoft Excel"