Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
I have a situation where I would like to Sum, Average, etc entirely within VBA eg Dim CountCol As Integer Dim AvScore As Single CountCol=Worksheets("Search").Evaluate("ROWS(H8:H3 00)-COUNTBLANK(H8:H300)") 'Would this be even close for the next bit? (Which I know is wrong) AvScore=Worksheets("Search").Evaluate("AVERAGE(8, 11):(8+CountCol, 11)") 'The result from this is then allocated to a particular cell Sheets("Sheet1").Range("A11").Value = AvScore Thanks in advance Sandy |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
One way:
Dim nCountCol As Long Dim dAvScore As Double With Worksheets("Search") nCountCol = Application.WorksheetFunction.CountIf( _ .Range("H8:H300"), "<" & vbNullString) dAvScore = Application.WorksheetFunction.Average( _ .Range("K8").Resize(nCountCol, 1)) End With Sheets("Sheet1").Range("A11").Value = dAvScore In article , "Sandy" wrote: Hi I have a situation where I would like to Sum, Average, etc entirely within VBA eg Dim CountCol As Integer Dim AvScore As Single CountCol=Worksheets("Search").Evaluate("ROWS(H8:H3 00)-COUNTBLANK(H8:H300)" ) 'Would this be even close for the next bit? (Which I know is wrong) AvScore=Worksheets("Search").Evaluate("AVERAGE(8, 11):(8+CountCol, 11)") 'The result from this is then allocated to a particular cell Sheets("Sheet1").Range("A11").Value = AvScore Thanks in advance Sandy |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You shouldn't need to use evaluate unless you are using a sumproduct
formula. Try 'MsgBox Application.Average(Range("h3:k4")) sheets("sheet1").range("a11")= Application.Average(Range("h3:k4")) -- Don Guillett SalesAid Software "Sandy" wrote in message ... Hi I have a situation where I would like to Sum, Average, etc entirely within VBA eg Dim CountCol As Integer Dim AvScore As Single CountCol=Worksheets("Search").Evaluate("ROWS(H8:H3 00)-COUNTBLANK(H8:H300)") 'Would this be even close for the next bit? (Which I know is wrong) AvScore=Worksheets("Search").Evaluate("AVERAGE(8, 11):(8+CountCol, 11)") 'The result from this is then allocated to a particular cell Sheets("Sheet1").Range("A11").Value = AvScore Thanks in advance Sandy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
CELLS NOT CALC FORMULAS - VALUES STAY SME FORMULAS CORRECT?? HELP | Excel Worksheet Functions | |||
automatically copy formulas down columns or copy formulas all the | Excel Worksheet Functions | |||
Formulas not evaluated, Formulas treated as strings | Excel Discussion (Misc queries) | |||
formulas | New Users to Excel | |||
formulas for changing formulas? | Excel Discussion (Misc queries) |