### StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x)

Basic and Crystal syntax.

##### Arguments

- fld is any valid database or formula field that can be evaluated by the function.
- condFld is a field used to group the values in fld by.
- cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
- x is an array of values that can be evaluated by the function being used.

##### Returns

Fractional Number

##### Action

Enables you to find the standard deviation of a set of values in your report. For example:

- You can calculate the grand total standard deviation for all values in a field. For information about this kind of summary, see SummaryFunction (fld).
- You can calculate the standard deviation for all values within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
- You can calculate the standard deviation for all values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
- If you specify a set of individual values, you can compute the standard deviation of the values in the set. For information on this kind of summary, see Array summary functions (x).

##### Examples

The following examples are applicable to both Basic and Crystal syntax:

`StdDev({file.RESULTS})`

Calculates the standard deviation of all values in the Result field.

`StdDev({orders.AMOUNT}, {orders.CUSTOMER ID})`

Calculates the standard deviation for the orders in each group of orders in the Orders field. The orders are separated into groups whenever the value in the Customer field changes.

`StdDev({file.RESULTS}, {file.DATE}, "daily")`

Calculates the variation for each group of laboratory test results in the Results field. The test results are separated into groups whenever the value in the Date field changes to a new day.

`StdDev({file.SCORES}, {file.NATURALIZED}, "any change")`

Groups values in the Scores field based on whether or not the test taker is a naturalized citizen, and calculates the standard deviation for each group of scores.

The following example is applicable to Crystal syntax:

`StdDev([({file.QTY1} * {file.PRICE1}),({file.QTY2} * {file.PRICE2}),({file.QTY3} * {file.PRICE3}), ({file.QTY4} * {file.PRICE4})])`

Returns 36.60 where Qty1 = 2, Price1 = 10.00, Qty2 = 2, Price2 = 2.00, Qty3 = 10, Price3 = 3.00, and Qty4 = 8, Price4 = 11.00.

##### Comments

Standard deviation is calculated using the following technique:

- It calculates the average (mean) value for the items in the sample.
- It subtracts the average value from the value of each item.
- It squares the difference for each item.
- It adds the squared differences for all of the items in the sample.
- It divides the sum by one less than the number of items in the sample (N - 1). The result is the variance. Compare this step to the PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x).
- It calculates the square root of the variance to arrive at the standard deviation.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com