Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default some code sets a variable to a sumif formula, offset 2

There is a sheet that is gives updated figures called dct_count.xls. Then
there is the active sheet I'm trying to update. The dct count sheet column
E:E is updated with column d of active sheet. I can't quite understand the
code. There is a sub-routine that sub-totals 3 of the columns including the
DCT's D column.

First it initializes it to 0. Then sets column D for each sub-total range
to this sumif
formula and the offset is 2? There is a column H with service groups.
There are 2 other columns, as well as the dct column, that are sub-totaled
after each service group range.


Set DCT_Count_Range =
Intersect(Workbooks("dct_count.xls").Sheets("dct_c ount").Range("E:E"),
Workbooks("dct_count.xls").Sheets("dct_count").Use dRange)
DCT_Count_Range.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

For Each C In Intersect(Range("D12:D64000"), ActiveSheet.UsedRange)
DCT = 0

DCT = Application.WorksheetFunction.SumIf(DCT_Count_Rang e, C.Value,
DCT_Count_Range.Offset(0, 2))
C.Offset(0, 2).Value = DCT

Next C
Application.Calculate

Set Streams_Needed = Intersect(Range("G12:G64000"),
ActiveSheet.UsedRange)


Question: What is the calculation here?
Is it setting the last cell in the C range to be the sumif formula.......
so that it will calculate the sub-total for each service group and then it is
told to calculate?

The sub-total row gets removed by a subroutine and then added back after
each update process I may be wrong on this supposition because
in the sub-total routine it adds 3 columns on the active sheet including DCT
and it appears to be setting the formula at the end of each service group to
sub-total the 3 columns using sumif formulas. So if it is doing it there
what is it doing here?

I don't understand what the 2 row offset does? For example, say it is in
the last row of the first service group doing a comparison then wouldn't it
be an offset of 1 or does it count the row it is currently on and then one
down and that would be 2?

It sets the range for the streams needed for a sub routine that is called
next. Maybe if I can understand this then I can understand the sub-routine
and why there is a mistake in only one range for one of the sub-totals.
tia,


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
Sumif with multiple sets of duplicates Lou Nunez Excel Worksheet Functions 4 October 23rd 09 05:05 PM
Excel: Sumif function with two sets of criteria? Can it be done? Steelfan Excel Discussion (Misc queries) 2 May 7th 08 05:28 PM
select offset (variable ,1) to offset(variable ,variable) Buffyslay Excel Programming 1 November 15th 06 11:45 AM
SUMIF with two sets of criteria luvthavodka Excel Discussion (Misc queries) 5 May 29th 06 08:02 PM
for SUMIF function, how do I use 2 sets of range & criteria Bob Excel Worksheet Functions 6 January 10th 06 07:48 PM


All times are GMT +1. The time now is 06:40 AM.

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"