by http://www.paretoanalysts.com (5 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 12th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Arithmetic Mean is a visual basic algorithm used in statistical analysis, data mining or data analysis for calculating the Arithmetic Mean of
On Error GoTo ErrorHandler
'***********************************************************************
'
'Purpose: Algorithm that calculates the average of a series of numbers.
'
'Argument(s): Numbers - comma separated list of numbers.
'
'Source: http://www.paretoanalysts.com
'
'Author: Pareto Analysts
'
'Creation Date: December 1, 2001
'
'Description: Calculates the arithmetic mean or average of a series of numbers
' for use in statistical analysis, data mining or data analysis.
' E.g. ArithmeticMean(200,345,444,666)
'
'Return Value: The arithmetic mean of the series passed to the function
'
'Return Type: Variant
'
'
'***********************************************************************
Dim varNum As Variant
Dim varTotal As Variant
Dim varCount As Variant
'Count the number of elements in the array
varCount = 0
varTotal = 0
For Each varNum In Numbers()
If IsNumeric(varNum) And Not IsEmpty(varNum) Then 'Check if the variable is a valid number
varTotal = varTotal + varNum 'Add all the numbers
varCount = varCount + 1 'Count the number elements in the series
Else
Err.Raise vbObjectError + 1000, "www.paretoanalysts.com ArithmeticMean ", "Only numeric values can be used."
Exit Function
End If
Next
ArithmeticMean = (varTotal / varCount) 'Calculate the arithmetic mean or average
Exit_ErrorHandler:
Exit Function
ErrorHandler:
MsgBox Err.Number & " " & Err.Description, vbInformation, "www.paretoanalysts.com ArithmeticMean "
End Function
No comments have been posted about Arithmetic Mean is a visual basic algorithm used in statistical analysis, data mining or data analy. Why not be the first to post a comment about Arithmetic Mean is a visual basic algorithm used in statistical analysis, data mining or data analy.