Category: FUNCTION | Updated: 2026-11-22

How to Use the DSTDEV Function in Google Sheets | Calculate Sample Standard Deviation Matching Criteria

Syntax

=DSTDEV(database, field, criteria)
  • database: Specifies the entire cell range of the data, including headers in the first row.
  • field: Specifies the header name of the column for which to calculate standard deviation, or its column number from the left.
  • criteria: Specifies the cell range containing the filter conditions (headers + condition values).

Practical Example with a Table

Here is an example of calculating the sample standard deviation of product weights for “Factory is Plant 1” (specified in criteria range E1:E2) from factory weight inspection data (A1:C8).

Cell Range Role Contents
A1:C8 Database Row 1: Factory, Lot, Weight / Rows 2–8: sample inspection data
E1:E2 Criteria Range E1 = Factory, E2 = Plant 1
Formula Cell Standard Deviation Result =DSTDEV(A1:C8, "Weight", E1:E2) → Outputs the spread of sample weights at Plant 1

Common Errors and Notes

  • #DIV/0! Error: Occurs when fewer than 2 numeric records (0 or 1) match the criteria.
  • #VALUE! Error: Occurs when the field column name is not found in the database header row.
  • Calculating for an Entire Population: If you are calculating the standard deviation for complete census data rather than a sample, use the DSTDEVP function instead.

Frequently Asked Questions

Q. What is the difference between the DSTDEV function and the DSTDEVP function?

A. DSTDEV calculates the "unbiased standard deviation" (dividing by n-1) to estimate the population standard deviation from a sample. If your data represents the entire population, use DSTDEVP (dividing by n).

Q. What happens if only one record matches the criteria?

A. Because sample standard deviation uses `n - 1` in the denominator, matching 1 or fewer records causes division by zero and triggers a "#DIV/0!" error.