How to Use the STDEV.S and STDEV.P Functions in Google Sheets to Calculate Standard Deviation

Measuring data dispersion and volatility is a foundational requirement across financial analysis, scientific experiments, quality assurance, and statistical reporting. While calculating the mathematical average (arithmetic mean) identifies the central tendency of a dataset, it reveals nothing about how widely the individual values deviate from that midpoint. Standard deviation quantifies this variance. In Google Sheets, two distinct functions perform this calculation: STDEV.S (for sample subsets) and STDEV.P (for entire populations). Selecting the correct variant is vital for avoiding statistical bias.

Sample vs Population Standard Deviation: The Mathematical Difference

Understanding which function to implement depends on whether your dataset constitutes a representative sample or the entire universe of data points:

  • Sample Standard Deviation (STDEV.S): Implements Bessel’s correction by dividing the sum of squared deviations by n - 1 (where n is the count of observations). This correction compensates for the systemic tendency of random samples to underestimate true population variance. Use STDEV.S when analysing clinical trial participants, a survey subset of customers, or monthly sales samples.
  • Population Standard Deviation (STDEV.P): Divides the sum of squared deviations by N (the total population size). Use STDEV.P exclusively when your dataset includes every single member of the target population—such as test scores for every pupil in a private classroom, or quarterly performance metrics for all 50 full-time employees in a specific business unit.

Syntax and Function Specifications

Both functions accept cell ranges, individual numbers, or array expressions:

=STDEV.S(value1, [value2, ...])
=STDEV.P(value1, [value2, ...])
  • value1: The first value, range, or array of numerical data to evaluate (for example, A2:A100).
  • [value2, ...] (Optional): Additional values or disconnected cell ranges to include in the statistical calculation.

Step-by-Step Practical Implementation

To demonstrate standard deviation calculations, consider an operational dataset containing weekly server latency records in milliseconds located in cells B2:B25:

Calculating Sample Standard Deviation with STDEV.S

Because 24 weeks represents a sample of ongoing server operations across multiple years, use STDEV.S:

  1. Click cell D2 where you want the metric to appear.
  2. Type the formula:
    =STDEV.S(B2:B25)
  3. Press Enter. If the mean latency is 45 ms and STDEV.S returns 4.2, approximately 68% of latency measurements fall within one standard deviation ($\pm 4.2\text{ ms}$, between 40.8 ms and 49.2 ms) assuming normal distribution.

Calculating Population Standard Deviation with STDEV.P

If you have an archived, completed 10-day marketing sprint with fixed daily click-through numbers in C2:C11 that will never undergo further sampling:

  1. Click cell E2.
  2. Type the formula:
    =STDEV.P(C2:C11)
  3. Press Enter. Google Sheets calculates the exact population variance without applying n - 1 weighting.

Legacy Functions vs Modern Standards

Google Sheets maintains backwards compatibility with earlier spreadsheet naming conventions, but modern syntax should always be preferred:

  • STDEV is identical in behaviour to STDEV.S. Modern spreadsheets introduced the .S suffix to eliminate ambiguity.
  • STDEVP is identical in behaviour to STDEV.P. Use STDEV.P for clarity and consistency across collaborative workbooks.
  • STDEVA and STDEVPA evaluate text and boolean values (treating TRUE as 1 and FALSE or text strings as 0). By contrast, STDEV.S and STDEV.P automatically ignore text strings and blank cells.

Combining Standard Deviation with Filtered Criteria

To compute standard deviation on a dynamic subset of data meeting specific conditions (such as computing latency deviation only for EU server nodes), combine STDEV.S with the FILTER function:

=STDEV.S(FILTER(B2:B100, A2:A100 = "EU-West"))

The FILTER function strips away non-matching rows before passing the filtered numeric array into STDEV.S.

Troubleshooting Common Errors

When working with statistical functions in Google Sheets, watch for these common error conditions:

  • #DIV/0! Error: Occurs in STDEV.S if your target range contains fewer than two numerical data points (since n - 1 = 0, resulting in division by zero). Ensure your evaluation range contains at least two numeric values.
  • #VALUE! Error: Occurs if non-convertible text is directly passed as a discrete argument (e.g., =STDEV.S(10, "apples", 30)). When referencing ranges (e.g., A1:A10), text values inside cells are automatically skipped rather than throwing an error.
  • Zero Standard Deviation (0): If all values in the evaluated range are identical (e.g., all cells equal 50), there is zero dispersion, and the function correctly returns 0.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.