DSTDEV function

Returns the standard deviation of values in a database field that match criteria, showing how much the numeric data spreads out.

=DSTDEV(database, field, criteria)

Generate a DSTDEV formula

Describe what you need. The generator will reach for DSTDEV where DSTDEV is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How DSTDEV reads its arguments
databaserequiredfieldrequiredcriteriarequiredDSTDEV
ArgumentRequiredDescription
databaseRequiredThe range containing the database table including all column headers and data rows; must be rectangular with headers in the first row.
fieldRequiredThe column to analyze, specified as a text header name (like "Salary") or a numeric column position; must exist in the database headers.
criteriaRequiredA range with column headers matching the database, plus rows below containing filter values; use comparison operators like >, <, >=, <= for numeric/date conditions.

Returns

A number representing the sample standard deviation of matching field values.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Salary variation in Sales department

Employee IDNameDepartmentHire DateSalaryStatus
1Alice JohnsonSales2020-01-1560000Active
4David WilsonSales2018-11-0575000Active
=DSTDEV($A$1:$F$7, "Salary", $A$9:$B$10)

Result: 10606.61

DSTDEV matches rows where Department='Sales', selecting Alice ($60k) and David ($75k). The sample standard deviation of these salaries is 10606.61, showing moderate variation in this department's compensation.

2. Salary variation in Engineering department

Employee IDNameDepartmentHire DateSalaryStatus
2Bob SmithEngineering2019-06-2090000Active
3Carol DavisEngineering2021-03-1080000Active
=DSTDEV($A$1:$F$7, "Salary", $A$12:$B$13)

Result: 7071.07

This formula filters for Department='Engineering', matching Bob ($90k) and Carol ($80k). The resulting standard deviation of 7071.07 is lower than Sales, indicating less salary dispersion within the engineering team.

3. Salary variation for recent hires hired after 2020

Employee IDNameDepartmentHire DateSalaryStatus
3Carol DavisEngineering2021-03-1080000Active
5Emma BrownHR2022-01-3055000Active
=DSTDEV($A$1:$F$7, "Salary", $A$15:$B$16)

Result: 17677.67

Using a date criteria (Hire Date > 2020-12-31), DSTDEV selects Carol (hired 2021, $80k) and Emma (hired 2022, $55k). Their standard deviation of 17677.67 is the highest, revealing a substantial salary gap among recent hires.

Common errors

Which DSTDEV error are you seeing?
DSTDEV returned an error#N/A
Verify the column name matches exactly, including spelling and case; check that it appears in the first row of the database range.
#VALUE!
Ensure the criteria range has proper column headers in the first row that match the database table's headers exactly.
#NUM!
Broaden the criteria to match more records, or use DCOUNT first to verify your criteria match at least two rows.
ErrorWhy it happensHow to fix it
#N/AThe field argument specifies a column name that does not exist in the database headers.Verify the column name matches exactly, including spelling and case; check that it appears in the first row of the database range.
#VALUE!The criteria range is malformed: column headers don't match the database, or the range structure is invalid.Ensure the criteria range has proper column headers in the first row that match the database table's headers exactly.
#NUM!No records match the criteria, or only one record matches; sample standard deviation requires at least two values to calculate.Broaden the criteria to match more records, or use DCOUNT first to verify your criteria match at least two rows.

Tips and when to use something else

  • Use DSTDEVP instead of DSTDEV when you want population standard deviation (dividing by n) rather than sample standard deviation (dividing by n-1).
  • Column headers in the criteria range must match the database headers exactly—copy them directly to avoid spelling and capitalization errors.
  • Combine DSTDEV with DCOUNT to verify your criteria match enough records before running the calculation; at least 2 values are needed.
  • For complex filtering without database functions, consider using STDEV with array formulas or helper columns instead of DSTDEV.

Frequently asked questions

What's the difference between DSTDEV and DSTDEVP?
DSTDEV calculates sample standard deviation (dividing by n-1), appropriate when your filtered data represents a sample. DSTDEVP calculates population standard deviation (dividing by n), used when your filtered data is the complete population. Choose based on whether your records represent a subset or the full dataset.
How do I filter by multiple conditions at once with DSTDEV?
Use AND logic by placing multiple criteria in the same row: put the column names (Department, Status) as headers across columns, then put the matching values (Sales, Active) in the row below. All criteria in a row must match for a record to be included. Use multiple rows for OR logic (either condition).
Why does DSTDEV return an error when my criteria match only one record?
Sample standard deviation requires at least two values to calculate variation. With only one record, there's no spread to measure. Either broaden your criteria to include more matching records, or use DSTDEVP if you're calculating population variation.
Can I use date or numeric comparisons like 'greater than' in DSTDEV criteria?
Yes, DSTDEV supports comparison operators (>, <, >=, <=, =, <>) in the criteria range for numeric and date columns. Enter the operator with the value, such as ">2020-12-31" to find dates after that date or ">50000" for salaries above that threshold.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17