Manage Learn to apply best practices and optimize your operations.

# Find The Min, Max, Average And Standard Deviation For A Set Of Numbers.

### Looking for something else?

If you have a list of numbers ( text or numbers ) and you want to find the
smallest ( Min ), largest ( Max ), average ( Average ) and standard deviation (
StdDeviation) for all of the numbers in the list, then the following functions

You must pass in a list of numbers as Src1 to each function you will use. Each
Function will call the "ConvertToNumberArray" function and perform the
calculations to determine the correct answer.
Function ConvertToNumberArray(Src1 As Variant) As Variant
S1 = SetArray(Src1)
Dim R1
ub1 = Ubound(S1)
dt1 = Datatype(S1(0))
If dt1 < V_STRING Then
R1 = S1
Else
Redim R1(ub1)
For i = Lbound(S1) To ub1
R1(i) = Cdbl(S1(i))
Next
End If
ConvertToNumberArray = R1
End Function

Function Max(Src1 As Variant) As Variant
S1 = ConvertToNumberArray(Src1)
max = - 10 ^ 60
Forall numv In S1
If numv > max Then
max = numv
End If
End Forall
Max = max
End Function

Function Min(Src1 As Variant) As Variant
S1 = ConvertToNumberArray(Src1)
min = 10 ^ 60
Forall numv In S1
If numv < min Then
min = numv
End If
End Forall
Min = min
End Function

Function Average(Src1 As Variant) As Variant
S1 = ConvertToNumberArray(Src1)
Forall numv In S1
sum = sum + numv
End Forall
Average = Round((sum / Ubound(S1)), 2)
End Function

Function StdDeviation(Src1 As Variant) As Variant
S1 = ConvertToNumberArray(Src1)
elem = Ubound(S1)
Forall numv In S1
sum = sum + numv
End Forall
mean = Round((sum / elem), 2)
Forall numv In S1
sumSquared = sumSquared + ((numv - mean) ^ 2)
End Forall
StdDeviation = Round(Cdbl(Sqr(sumSquared / ( elem - 1))), 2)
End Function
This was last published in November 2000

#### Start the conversation

Send me notifications when other members comment.

## SearchWindowsServer

• ### Server Core management remains a challenge for some

Server Core, the minimal Windows Server deployment, removes some admins from their GUI comfort zone, but its benefits reduce some...

• ### Meltdown and Spectre vulnerabilities dominate January Patch Tuesday

Complications surrounding the fix for the Meltdown and Spectre microprocessor architecture flaws will make the patching process ...

• ### Windows Server hardening still weighs heavily on admins

Windows Server hardening procedures drew renewed interest following the rash of ransomware outbreaks this year. See what tips on ...

## Search400

• ### iSeries tutorials

Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

• ### V6R1 upgrade planning checklist

When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

• ### Connecting multiple iSeries systems through DDM

Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

## SearchDataCenter

• ### Three requirements for a hybrid cloud computing deployment

As the hybrid cloud computing approach gains steam, organizations will need to pay close attention to cross-cloud connectivity ...

• ### Five debunked myths about SSD issues

Solid-state drives are mature now, and the technology has eclipsed hard disk drives with superior performance, manageability and ...

• ### Future data center trends hinge on the edge, cloud and staffing

Edge computing, colocation, cloud and IT staffing issues lead the way as industry analysts make their predictions for the future ...

## SearchExchange

• ### Compliance Manager tool aims to ease security audit process

Administrators who wrestle with compliance tasks in Office 365 and Azure workloads might find some relief with Microsoft's ...

• ### Set Office 365 group limits to avoid administrative hassles

With help from PowerShell, administrators can tailor Office 365 Groups to develop common-sense restrictions on the tools and ...

• ### The top Exchange and Office 365 tutorials of 2017

Exchange Server remains a solid messaging choice, but interest in Microsoft's cloud platform shows no sign of abating. These ...

## SearchContentManagement

• ### Intelligent information management the next wave for ECM

In a 2018 upgrade, M-Files allows users to search for content in multiple repositories, while also being able to automatically ...

• ### SharePoint integration and implementation best practices

Here are some expert advice and tips, as well common definitions, to help make your SharePoint integration and implementation a ...

• ### SharePoint branding capabilities get a facelift

Since Microsoft Ignite last September, SharePoint Online is getting new branding capabilities that have been on the wish lists of...

Close