This category contains various math routines covering the areas of statistics and probability. VBA has built-in functions for various mathematical operations. Search online help for "Math Functions" and "Derived Math Functions" for more information.

Procedure Name | Type | Description |

(Declarations) | Declarations | Declarations and private variables for the modMathStatistics module. |

Factorial | Procedure | Get the factorial of a given number. This function only works for values between 0 and 170. 170 is the maximum because the factorial of any number greater than 170 is beyond the numeric range of VBA/VB6. |

FactorialRecursive | Procedure | Get the recursive factorial of a given number. This function only works for values between 0 and 170. 170 is the maximum because the factorial of any number greater than 170 is beyond the numeric range of VBA/VB6. |

GetArrayMean | Procedure | Get the mean of the elements in the supplied array. |

GetArrayMedian | Procedure | Get the median of the elements in the supplied array. fSort should be set to True if you are not concerned with the order of the numbers in your array. If you do not want the array you pass to be sorted, set fSort to False. |

GetArrayMode | Procedure | Get the mode (most common value) of the supplied array. If there is a tie, the smallest number is the mode. This function also includes information on calculating standard error and coefficient of variance. |

GetArrayStatistics | Procedure | Calculate descriptive statistics of an array using N-1 method. Also includes information on calculating standard error and coefficient of variance. |

GetArrayStdDev | Procedure | Get the standard deviation of the supplied array using N-1 method. |

GetNumberCombinations | Procedure | Get the number of combinations of items that can be derived from a population (order does not matter). Combinations are different from permutations, because permutations count the number of ways (orders) items can be selected from the pool. For instance, with playing cards, there is only one combination of 4 Aces (all four cards), but there are many permutations depending on the order the Aces appear (diamond first, spade next, etc.). All the permutations result in the same combination. |

GetNumberPermutations | Procedure | Get the number of combinations of intItems that can occur from intPool (order matters). Unlike combinations, permutations count the number of ways (orders) items can be selected from the pool. For instance, with playing cards, there is only one combination of 4 Aces (all four cards), but there are many permutations depending on the order the Aces appear (diamond first, spade next, etc.). All the permutations result in the same combination. |

GetTableMedianDAO | Procedure | Get the median of a table's field using DAO. The median is the 50th percentile. Half the data is greater than this value and half is less than this value. |

GetTableMedianADO | Procedure | Get the median of a table's field using ADO. The median is the 50th percentile. Half the data is greater than this value and half is less than this value. |

GetTableModeDAO | Procedure | Get the mode (most common value) of the named field in the specified Jet database. This function uses a SQL string to calculate the mode by counting by group. |

GetTableModeADO | Procedure | Get the mode (most common value) of the named field in the specified Jet database. This function uses a SQL string to calculate the mode by counting by group. |

QuickSortStatArray | Procedure | Recursively sort the passed array of doubles (quicksort algorithm). |

The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!

is Shipping!

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP