Updated July 21, 2017

Built-in Standard Deviation Function

Open Excel and the data set where you want to find the standard deviation. Type"=STDEV(" in the cell where you want to display the standard deviation. Do not press “Enter.” Holding down shift, select the range of cells containing the data points. If the cells are not continuous, hold down Ctrl while selecting the non-continuous cells. This should place a series of cells names in the formula bar after “=STDEV(”. Type “)” in the formula bar and press “Enter.” The standard deviation will be calculated using the unbiased method.

Using Built-in Functions in VBA

This same built-in function can be used in a VBA script to calculate standard deviation. Open VBA and click on the end of the module where you are going to calculate the standard deviation. Type “Function StDev( Rng As Range)” and then press “Enter.” This should also create a new line “End Function.” On the line between “Function …” and “End Function,” type “StDev = Application.WorksheetFunction.StDev( Rng)” and then press “Enter.” To calculate the standard deviation in VBA, simply use the function StDev(). Tips Writer Bio

How to Calculate Standard Deviations in Excel Visual Basic - 12