
Quick answer
Standard deviation measures how spread out a set of numbers is around its average. In Excel, use =STDEV.S(range) for a sample and =STDEV.P(range) for an entire population. Both ignore blank cells and text. If you need text and logical values (TRUE/FALSE) counted too, use STDEVA (sample) or STDEVPA (population) instead.
Two sales reps hit the same average. One of them closes deals close to that number every time. The other swings from huge wins to total misses.
The average alone can’t tell them apart. Standard deviation can. It measures how spread out a set of numbers is around its average, and Excel has a function for it.
In this Ninja Excel guide you’ll calculate standard deviation with STDEV.S and STDEV.P, see the difference between the modern functions and the legacy ones, and learn how STDEVA and STDEVPA change the result when text or logical values are involved.
What you’ll learn in this article
- What standard deviation is
how it measures spread around an average, shown with a side-by-side example. - How to calculate it in Excel with STDEV.S and STDEV.P
the syntax, the arguments and which one to use for a sample versus a whole population. - The difference between the modern and the legacy functions
why STDEV and STDEVP still exist and why Microsoft recommends STDEV.S and STDEV.P instead. - How STDEVA and STDEVPA treat text and logical values
worked examples showing exactly how a text cell, a FALSE and a TRUE change the result.
By the end of this article: you’ll know which standard deviation function to use in Excel and why, for any data set.
Reading time: 9 minutes | Level: intermediate | For: anyone who analyzes data sets in Excel
What is standard deviation?
Standard deviation measures how spread out a set of numbers is. That spread is calculated against the average (mean) of the set. A low standard deviation means most numbers sit close to the average. A high standard deviation means they spread over a wider range.
We can see this in the following example, where we use Excel to calculate the average and the standard deviation of two groups. Both groups have the same average, but different standard deviations:

Group 2 has a higher standard deviation because its numbers sit farther from the group’s average of 6.
Let’s add a third group:

The third group keeps the same average as the other two, but with a standard deviation of 0. Every number is identical, so there’s no spread at all around the average.
How do you calculate standard deviation in Excel?
The function you need depends on whether you’re calculating the standard deviation of a sample or of an entire population.
Ninja Tip
In STDEV.S and STDEV.P, the letter after the dot tells you which one to use: S is for sample, P is for population.
If you’re calculating the standard deviation of the salaries at an entire company, use STDEV.P, since that’s the whole population. If you only have a smaller group of those salaries, a sample, use STDEV.S.
In the following example, the two functions return different results for the same data:

Ninja Tip
As the number of data points grows, the difference between these two functions gets smaller.
STDEV.S and STDEV.P: standard deviation for samples and populations
The basics
Characteristics: only the first value is required, the rest are optional. The numeric arguments can be numbers, rows, columns or arrays. These functions skip blank cells and cells that contain text.
Syntax:
=STDEV.S(number1, [number2], …)
=STDEV.P(number1, [number2], …)
Arguments:
- number1 = the first numeric argument.
- number2, number3, … = the rest of the numeric arguments. You can use up to 255 arguments in total.
Using STDEV.S and STDEV.P
Since STDEV.S and STDEV.P work the same way and only differ in when you should use them, the following examples use STDEV.S. Everything applies to STDEV.P too.
As we just saw in the syntax, calculating standard deviation in Excel only needs numeric arguments. Each of those arguments can be a number, a row, a column or an array.
In the next example, each number used in the calculation is selected as a separate argument:
Ninja Tip
Hold down Ctrl (Cmd on a Mac) to select new cells without clearing what you already selected. This is useful for selecting large sets of data that are not next to each other.

Here, cell B3 is the first argument (5), cell C3 is the second, and so on. This gives us the following result:

=STDEV.S(B3,C3,D3,E3,F3)
Result: 7.91
If we now select the whole row as a single argument instead, we get the same result:


As we can see, we get the same 7.91 as in the first example.
Another important point: STDEV.S and STDEV.P skip blank cells and cells that contain text when calculating standard deviation.
In the next example, we add a blank cell and a cell that says “text” to the range used for the calculation:

Excel still returns the same standard deviation as before:

Difference between STDEV.S/STDEV.P and the legacy STDEV/STDEVP
You might be wondering what the difference is between Excel’s STDEV and STDEV.S. Both functions do exactly the same thing: return the sample standard deviation.
The same way, STDEV.P does the same thing as STDEVP: return the population standard deviation.
STDEV.S and STDEV.P are the updated versions of STDEV and STDEVP. Microsoft still keeps both versions in Excel, for compatibility with older versions of the program. Even so, Microsoft recommends using STDEV.S and STDEV.P, since they may provide improved accuracy and their names better describe what they do.
As the example shows, we get the same result using STDEV and STDEV.S:


Both functions return 7.91 as the sample standard deviation.
Ninja Summary
- STDEV.S (sample) and STDEV.P (population) are the modern names for STDEV and STDEVP.
- Both skip blank cells and cells that contain text.
- Selecting arguments one by one or as a single range gives the same result.
How do STDEVA and STDEVPA handle text and logical values?
The basics
Purpose: STDEVA returns the standard deviation of a sample, but counting text and logical values. STDEVPA does the same, but for a population.
Characteristics: only the first value is required, the rest are optional. Unlike STDEV.S and STDEV.P, the arguments aren’t just numbers. They can also be text and logical values.
Syntax:
=STDEVA(value1, [value2], …)
=STDEVPA(value1, [value2], …)
Arguments:
- value1 = the first argument. Can be a number, text or a logical value.
- value2, value3, … = the rest of the arguments. You can use up to 255 arguments in total.
Including text in the calculation
Unlike STDEV.S and STDEV.P, when you calculate standard deviation with STDEVA, cells that contain text are treated by the function as cells with a value of 0.
In the next example, we use the same numeric range as in the STDEV.S example:

And we get the same standard deviation:

But once we add a cell that says “text” (it could be any word):

Excel now returns a different standard deviation:

The standard deviation increased from 7.91 to 9.35. This happens because the “text” cell takes the value 0, which sits far from the rest of the values (their average is 15), so it pulls the standard deviation up.
Including logical values
STDEVA and STDEVPA also count logical values (TRUE or FALSE) when calculating standard deviation.
If you use “TRUE”, Excel treats it as a 1. If you use “FALSE”, Excel treats it as a 0.
If we go back to the previous example and replace the word “text” with “FALSE”:

We get the same result as before, since Excel treats “FALSE” as 0, just like it treated “text”.
But if we replace “FALSE” with “TRUE”:

The standard deviation calculated by Excel drops to 9.09. That makes sense, because 1 (“TRUE”) sits a little closer to the rest of the values than 0 (“FALSE”) did.
Ninja Summary
- STDEVA and STDEVPA count text and logical values that STDEV.S and STDEV.P would ignore.
- Text and FALSE are both treated as 0. TRUE is treated as 1.
- With numbers only, STDEVA and STDEVPA return the same result as STDEV.S and STDEV.P.
Summary of Excel’s standard deviation functions
| Function | Data type | Counts text and logical values | Updated version |
| STDEV | Sample | No | No |
| STDEV.S | Sample | No | Yes |
| STDEVP | Population | No | No |
| STDEV.P | Population | No | Yes |
| STDEVA | Sample | Yes | Yes |
| STDEVPA | Population | Yes | Yes |
Conclusion
For most data sets, STDEV.S is the function you’ll reach for, since most data you analyze is a sample. Switch to STDEV.P only when your range really is the entire population. If your range mixes in text or TRUE/FALSE values on purpose, STDEVA and STDEVPA count them instead of skipping them.
Take the next step with Excel courses
Standard deviation is one of many statistical functions that turn raw data into a decision. Ninja Excel courses cover every level, with hands-on exercises inside Excel.
Still eyeballing how spread out your numbers are?
Functions like STDEV.S stick when you practice them on real data. In Ninja Excel courses you solve exercises inside Excel, with live classes and progress reports for team leads.
You start with a skills assessment, so you don’t repeat what you already know.
FAQ
How do you calculate standard deviation in Excel?
Click the cell where you want the result and enter =STDEV.S(A1:A15) (for a sample) or =STDEV.P(A1:A15) (for a whole population), replacing the range with your own data.
How do you interpret standard deviation?
It tells you how spread out the numbers are. A low standard deviation means most values sit close to the average. A high one means they’re spread over a wider range.
What is standard deviation?
A measure used to quantify how much a set of numbers varies, or spreads out, from its average.
What’s the difference between STDEV.S and STDEV.P?
STDEV.S treats your data as a sample of a larger group and divides by n−1. STDEV.P treats your data as the entire population and divides by n. Use STDEV.S unless you’re certain your range is the whole population.
Do STDEVA and STDEVPA give different results than STDEV.S and STDEV.P?
Only when the range includes text or logical values. With numbers only, STDEVA and STDEV.S return the same result, and so do STDEVPA and STDEV.P.
Does Excel have similar functions for variance?
Yes. VAR.S returns the sample variance and VAR.P returns the population variance. Standard deviation is the square root of variance, so STDEV.S(range) always equals SQRT(VAR.S(range)).


