Sample VB Script Calculations

Following are three sample VB scripts: one to return the total, one to return the average, and one to return a single value.

Total

'Total for Genealogy Alias

Result = 0

Dim i

For i = LBound(A) to UBound(A)

   Result = Result + A(i)

Next

Average

'Average for Genealogy Alias Inputs

Result = 0

Dim i

For i = LBound(A) to UBound(A)

   Result = Result + A(i)

Next

   Result = Result / ((UBound(A) - LBound(A)) + 1)

Single Value

’r;Single Value from Array

Result = A(0)