This week's book giveaway is in the
We're giving away four copies of a choice of
"Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac"
and have Joe Kissell on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Take Control of Upgrading to Yosemite
Take Control of Automating Your Mac
this week in the
excel VBA question
Joined: Apr 18, 2002
Dec 29, 2005 00:54:00
Function name: MyAverage
Input: the array of the above 5 cell (I hope i can be dynamic)
output: average of the non #NA cell. In this case 2.3333
Can anyone shed some light to write this little macro
Joined: Feb 16, 2001
Dec 29, 2005 23:09:00
Public Function GetAverage(ParamArray CellRanges() As Variant) As Double Dim Cel As Range Dim MyAvg As Double Dim Myranges() As Range Dim Results() As Double Dim I As Integer ReDim Myranges(UBound(CellRanges)) ReDim Results((UBound(CellRanges))) For I = LBound(CellRanges) To UBound(CellRanges) Set Myranges(I) = Range(CellRanges(I)) For Each Cel In Myranges(I) Results(I) = Results(I) + Cel.Value Next Results(I) = Results(I) / Myranges(I).Cells.Count Next For I = LBound(Results) To UBound(Results) If CStr(Results(I)) <> "#N/A" Then MyAvg = MyAvg + Results(I) End If Next GetAverage = MyAvg End Function Private Function Average(MyRange As Range) As Double Dim Cel As Range Dim Result As Double For Each Cel In MyRange Result = Result + Cel.Value Next Average = Result / MyRange.Cells.Count End Function
subject: excel VBA question
== and equals in String Class
Nearest neighbour...How to find it?
can some one help me in this Prob plz
permutation combination problem
Whether the flow of a process is dynamic ?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014