Signature (Visual Basic / VBA)
Public Function TrimMean( _
ByVal vPercent As Variant _
, ParamArray vValues() As Variant _
) As Variant
Code Example
TrimMean(0.0, SampleData) = 145.152173913043
TrimMean(0.1, SampleData) = 144.654761904762
TrimMean(0.2, SampleData) = 144.108108108108
TrimMean(0.3, SampleData) = 143.878787878788
Parameters
| Parameter | Description |
|---|---|
| vPercent | The percent of data points to be excluded from the average. vPercent is expressed as a number between 0 and 1, so to exclude 20% of the data, use a vPercent value of .2. Half of the data is excluded from the bottom or the data and half from the top. |
| vValues | The values that are to be averaged. Can be numbers, one-dimensional numeric arrays, one-dimensional Variant arrays, one-dimensional Variant arrays with embedded arrays, or any combination of these. The current setting of the StatVarType Property determines which numeric data types are recognized by this function. |
Return Value
Function returns the mean of the remaining values in the middle of a data set. Function returns Null if none of the vValues arguments are numeric, or if vPercent is less than zero (<0) or greater than one (>1).