Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default count and sum of dynamic range ????

Still trying to get my macro to work. at this rate, i'll either b
really proud or completely gray headed by time it works.

I get a runtime error '13': Type mismatch on the underlined text when
try to run the macro. it takes compares two cells in one row to tw
cells in the next row, and keeps a running sum of a third column unti
the two groups are no longer the same, then finds the average.

Range("BX8").Select

Do
Sum = 0
Count = 0

If ActiveCell.Offset(0, -74) & ActiveCell.Offset(0, -71)
ActiveCell.Offset(1, -74) & ActiveCell.Offset(1, -71) Then
Count = Count + 1
_Sum_=_ActiveCell.Offset(0,_-12).Value_+_1_
Else
Count = Count + 1
Sum = ActiveCell.Offset(0, -12).Value + 1
ActiveCell.Value = Sum / Count
Count = 0
Sum = 0
End If
ActiveCell.Offset(1, 0).Select


Loop Until ActiveCell.Offset(1, -74).Value = ""

End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default count and sum of dynamic range ????

if isnumeric(ActiveCell.Offset(0,_-12).Value) then
Sum = ActiveCell.Offset(0,-12).Value + 1
End if

however, if you are trying to accumulate a sum shouldn't it be
if isnumeric(ActiveCell.Offset(0,_-12).Value) then
Sum = ActiveCell.Offset(0,-12).Value + Sum
End if

and I suspect you shouldn't have the second

Count = Count + 1 right after the Else

--
Regards,
Tom Ogilvy

"wraithlead " wrote in message
...
Still trying to get my macro to work. at this rate, i'll either be
really proud or completely gray headed by time it works.

I get a runtime error '13': Type mismatch on the underlined text when i
try to run the macro. it takes compares two cells in one row to two
cells in the next row, and keeps a running sum of a third column until
the two groups are no longer the same, then finds the average.

Range("BX8").Select

Do
Sum = 0
Count = 0

If ActiveCell.Offset(0, -74) & ActiveCell.Offset(0, -71) =
ActiveCell.Offset(1, -74) & ActiveCell.Offset(1, -71) Then
Count = Count + 1
_Sum_=_ActiveCell.Offset(0,_-12).Value_+_1_
Else
Count = Count + 1
Sum = ActiveCell.Offset(0, -12).Value + 1
ActiveCell.Value = Sum / Count
Count = 0
Sum = 0
End If
ActiveCell.Offset(1, 0).Select


Loop Until ActiveCell.Offset(1, -74).Value = ""

End Sub


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default count and sum of dynamic range ????

Thanks,

That did it

--
Message posted from http://www.ExcelForum.com

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
Formula to count every other column (dynamic range) Darlene New Users to Excel 7 November 18th 08 09:27 PM
Dynamic Range in Excel that won't count formulas [email protected] Excel Discussion (Misc queries) 1 January 24th 08 10:47 PM
Count dynamic range S Davis Excel Worksheet Functions 6 February 26th 07 07:51 PM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
I would like to count # of occurences but have it be dynamic when. Sifedirector Excel Worksheet Functions 1 March 19th 05 02:27 PM


All times are GMT +1. The time now is 08:41 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"