Z Stat Formula Excel: How to Calculate Z-Scores
In this article
To calculate a Z-stat (Z-score) in Excel, use the =STANDARDIZE(x, mean, standard_dev) function, where x is your value, mean is the average of the dataset, and standard_dev is the standard deviation. A Z-score tells you how many standard deviations a specific data point is from the mean, allowing you to identify outliers or determine the probability of a value occurring within a normal distribution.
What You'll Need
- Microsoft Excel (any modern version)
- A dataset of numerical values (e.g., test scores, heights, or financial figures)
- The population mean (or the average of your sample)
- The population standard deviation (or the sample standard deviation)
Step-by-Step
There are two primary ways to calculate a Z-score in Excel: using the built-in STANDARDIZE function or building the formula manually. The manual method is often preferred by students and analysts who want to see the underlying math.
Method 1: Using the STANDARDIZE Function
- Organize Your Data: Enter your raw data points in a single column. For example, place your values in cells A2 through A21.
- Calculate the Mean: In an empty cell (e.g., C2), enter
=AVERAGE(A2:A21). This provides the average value of your dataset, which is required for the Z-score formula. - Calculate the Standard Deviation: In another empty cell (e.g., C3), enter
=STDEV.P(A2:A21)if you have the entire population, or=STDEV.S(A2:A21)if you are working with a sample. This measures the spread of your data. - Apply the STANDARDIZE Formula: In cell B2 (next to your first data point), enter the following formula:
=STANDARDIZE(A2, $C$2, $C$3). - Lock the References: Notice the dollar signs ($) in
$C$2and$C$3. These are absolute references. They ensure that when you drag the formula down, Excel always looks at the mean and standard deviation cells rather than shifting the reference downward. - Fill the Column: Click the small green square at the bottom-right corner of cell B2 and drag it down to B21. Excel will now calculate the Z-score for every value in your list.
Method 2: Using the Manual Formula
The mathematical formula for a Z-score is Z = (x - μ) / σ. You can replicate this exactly in Excel to have more control over the calculation.
- Prepare Your Constants: Just as in Method 1, calculate your mean in cell C2 and your standard deviation in cell C3.
- Enter the Manual Formula: In cell B2, type
=(A2 - $C$2) / $C$3. - Execute the Order of Operations: The parentheses are critical here. Excel follows the order of operations (PEMDAS). Without the parentheses, Excel would divide the mean by the standard deviation first and then subtract that result from your value, leading to an incorrect Z-score.
- Apply to All Rows: Drag the fill handle down to apply the formula to the rest of your dataset.
Converting Z-Scores to Probabilities (P-Values)
Once you have the Z-stat, you often need to find the probability (the area under the curve). To do this, use the NORM.S.DIST function.
- Enter the Probability Formula: In cell C2 (or any empty column), enter
=NORM.S.DIST(B2, TRUE). - Interpret the Result: The "TRUE" argument tells Excel to calculate the cumulative distribution function. This returns the probability that a value is less than or equal to your Z-score.
- Find the Upper Tail: If you need the probability of a value being greater than your Z-score, use
=1 - NORM.S.DIST(B2, TRUE).
Common Mistakes
- Forgetting Absolute References: The most common error is using
=STANDARDIZE(A2, C2, C3)instead of=STANDARDIZE(A2, $C$2, $C$3). When you drag this formula down, the second row becomes=STANDARDIZE(A3, C3, C4), which points to empty cells and results in a #DIV/0! or #VALUE! error. - Using STDEV.P instead of STDEV.S: Using the population standard deviation (STDEV.P) when you only have a small sample of a larger group can lead to an underestimated standard error and an inflated Z-score. Always use STDEV.S for sample data.
- Omitting Parentheses in Manual Formulas: Writing
=A2 - C2 / C3will result in a mathematically incorrect answer because division happens before subtraction. Always wrap the subtraction of the mean in parentheses. - Confusing Z-scores with T-scores: A Z-stat is used when the population variance is known or the sample size is large (typically n > 30). If your sample is small and you do not know the population variance, you should use a T-test (T-stat) instead of a Z-stat.
Tips
- Conditional Formatting for Outliers: Once your Z-scores are calculated, use Conditional Formatting > Highlight Cells Rules > Greater Than... and enter 3 (or Less Than -3). This will instantly highlight extreme outliers in your dataset.
- Using Named Ranges: Instead of using
$C$2, you can click on cell C2, go to the Name Box (top left), and name it "Mean". Then your formula becomes=STANDARDIZE(A2, Mean, StdDev), which is much easier to read and audit. - Data Validation: If you are building a template for others, use Data Validation to ensure that the standard deviation cell cannot be zero, as this would cause a division-by-zero error.
- Visualizing the Distribution: Create a histogram of your raw data before calculating Z-scores. If the data is heavily skewed (not a bell curve), the Z-score may be misleading, as Z-scores assume a normal distribution.
Troubleshooting
If your results look incorrect or Excel returns an error, follow these steps in order:
- Check for #DIV/0! Errors: This happens if your standard deviation is 0. This occurs if all the numbers in your dataset are identical. Check your data for entry errors or ensure there is actually variance in your numbers.
- Check for #VALUE! Errors: This usually means one of the cells referenced in your formula contains text instead of a number. Ensure there are no hidden spaces or characters in your data columns.
- Verify the Mean and StdDev: Manually calculate one Z-score on a calculator. Subtract the mean from the value, then divide by the standard deviation. If this matches your Excel result, your formula is correct.
- Review the Reference Locks: If the first row is correct but the subsequent rows are wrong, click on the second row's formula. Check if the mean and standard deviation references have shifted down one row. If they have, add the dollar signs ($) to lock them.
Frequently Asked Questions
What does a Z-score of 0 mean?
A Z-score of 0 indicates that the data point is exactly equal to the mean of the dataset. It is neither above nor below the average.
What is the difference between STANDARDIZE and NORM.S.DIST?
STANDARDIZE calculates the Z-score itself (how many deviations from the mean). NORM.S.DIST takes that Z-score and tells you the probability (the percentage of the population) that falls below that score.
When should I use a Z-stat instead of a T-stat?
Use a Z-stat when you know the population standard deviation or when your sample size is large (typically over 30). Use a T-stat when the sample size is small and the population variance is unknown.
Can a Z-score be negative?
Yes. A negative Z-score means the data point is below the average. For example, a Z-score of -1.5 means the value is one and a half standard deviations below the mean.
How do I find the Z-score for a specific percentile?
If you have a percentile (e.g., 95%) and want the corresponding Z-score, use the =NORM.S.INV(0.95) function. This is the inverse of the distribution function.