Buy Now

How To Calculate Z-Score in Excel

Feb 06, 2025
Image for how to calculate z score in excel

In statistics, a z-score (also called a standard score) measures how far a given data point is from the mean in terms of standard deviations. It is commonly used in data analysis to compare values from different datasets or identify outliers.

This guide will walk you through how to quickly calculate z-scores in Excel using AI. We will also show you the steps to calculate z-scores manually and with the STANDARDIZE function.

What Is the Z-Score Formula?

A z-score is calculated using the formula:

z = (X – μ) / σ

Where:

  • X = Individual data point

  • μ = Mean of the dataset

  • σ = Standard deviation of the dataset

Interpretation of Z-Scores

A z-score helps you understand whether a particular value is typical or unusual compared to the rest of the data. See how to interpret z scores below: 

  • Z-score is zero: The data point is exactly at the mean.

  • Positive z-score: The data point is above the mean.

  • Negative z-score: The data point is below the mean.

  • Magnitude: Indicates how many standard deviations the data point is away from the mean.

Prerequisites.

Here are the prerequisites for calculating z-scores in Excel:

  1. Organized data: Ensure your raw data is in a column/row (e.g., A1:A10).

  2. Excel functions: Familiarity with the Excel functions AVERAGE, STDEV.P (population), STDEV.S (sample), and STANDARDIZE.

Preparing Your Data in Excel

You need to ensure your data set is in order before you start calculating z-score in Excel. Here are some simple steps you can take:

  1. Open Microsoft Excel and input your dataset in a column (e.g., Column A).

  2. Ensure your data is well-structured, with no missing or incorrect values.

Calculating Z-Scores in Excel Using AI

If you want to automate the calculation of z-scores in Excel using VBA (Visual Basic for Applications), an AI tool like ChatGPT can help you generate the code. Here’s a step-by-step guide:

Step 1: Define Your Requirement Clearly

When asking ChatGPT, be specific about what you need. For example, you might say:

"I need a VBA code that calculates z-scores in Excel for a selected range of data. The code should calculate the mean, standard deviation, and output the z-scores in the next column."

The more details you provide, the better the code will fit your needs.

Step 2: Copy the VBA code.

After the AI tool provides the code, copy it. The code will typically look like this:

Sub CalculateZScores()
Dim rng As Range, cell As Range
Dim mean As Double, stdev As Double

Set rng = Application.InputBox("Select the data range:", Type:=8)
mean = WorksheetFunction.Average(rng)
stdev = WorksheetFunction.StDev_P(rng)

If stdev = 0 Then Exit Sub

For Each cell In rng
cell.Offset(0, 1).Value = (cell - mean) / stdev
Next cell
End Sub

Step 3: Open the VBA editor in Excel.

  • Press Alt + F11 to open the VBA Editor.

  • In the menu, click Insert > Module.

  • Paste the copied code into the module window.

  • Press Ctrl + S to save the VBA project.

Step 4: Run the VBA Code.

  • Close the VBA Editor by pressing Alt + Q.

  • Go back to Excel.

  • Press Alt + F8 to open the list of macros.

  • Select CalculateZScores and click Run.

  • When prompted, select the range of data you want to analyze.

  • The z-scores will appear in the next column.

Calculating the Mean and Standard Deviation in Excel

You need to calculate your dataset's mean and standard deviation before computing z-scores. If you don't know how to calculate the mean and standard deviation in Excel, you can learn below:

1. Calculate the mean.

In an empty cell (e.g., B1), type the formula =AVERAGE(range). For instance, =AVERAGE(A1:A5). Press Enter to get the mean.

In our example, the dataset's mean is 20.

2. Calculate the standard deviation.

In another cell (e.g., B2), type the standard deviation formula. Use =STDEV.S(range) for sample standard deviation and STDEV.P(range) for a full population.

The dataset's standard deviation is 7.07.

Computing Z-Scores in Excel

You can calculate z-scores in Excel in a couple of simple ways. Whether you prefer manual formulas or built-in functions, Excel provides flexible options to suit your data analysis needs.

Method 1. Manual calculation method.

Follow the steps below to calculate the z-score manually in your Excel worksheet:

  1. Go to a new column (e.g. column C). This is where you will enter your z-scores.

  2. In the first row of Column C (e.g., C1), enter the formula: =(A1 - $B$1) / $B$2

    • $B$1 is the mean (absolute reference so it doesn’t change when copied down).

    • $B$2 is the standard deviation (absolute reference).

  3. Press EnterThis will apply the Excel formula to the first value.

  4. Drag the fill handle down to apply the formula to all data points.

Method 2. Using Excel's STANDARDIZE function.

Excel provides a built-in function to compute z-scores more efficiently:

  1. In C1, type: =STANDARDIZE(A1, $B$1, $B$2)

  2. Press Enter.

  3. Drag the fill handle down to apply the function to all rows.

Interpreting the Results

Once calculated, the z-scores will help you determine the position of each data point relative to the dataset:

  • Z-score > 2: The value is significantly above average.

  • Z-score < -2: The value is significantly below average.

  • Z-score around 0: The value is close to the mean.

Common Pitfalls and Tips

While calculating z-scores in Excel is straightforward, mistakes can still occur. Awareness of common pitfalls can help you avoid errors and ensure accurate results.

  • Ensure correct range selection: Double-check your dataset range in formulas.

  • Use absolute references ($) for mean and standard deviation when copying formulas.

  • Choose the right standard deviation function: STDEV.S for samples, and STDEV.P for full populations.

  • Check for outliers: Extremely high or low z-scores indicate potential outliers.

Final Thoughts on "How To Calculate Z-Score in Excel"

Calculating z-scores in Excel allows you to analyze data, compare values, and identify outliers with ease. Excel provides flexible options to suit your workflow, including manual formulas, the STANDARDIZE function, or VBA automation. Following these steps in this guide, you can confidently compute z-scores and make more informed data-driven decisions.

For more easy-to-follow Excel guides and the latest Excel Templates, visit Simple Sheets and the related articles section of this blog post.

Subscribe to Simple Sheets on YouTube for the most straightforward Excel video tutorials!

FAQ on "How To Calculate Z-Score in Excel"

1. Can I calculate z-scores in Excel without VBA?
You can use the manual formula =(X - Mean) / Standard Deviation or the built-in STANDARDIZE function. Both methods provide accurate z-scores without needing macros.

2. What’s the difference between STDEV.S and STDEV.P in Excel?
STDEV.S calculates the standard deviation for a sample, while STDEV.P is used for an entire population. Choosing the wrong one can slightly affect your z-score accuracy.

3. How do I know if a z-score is an outlier?
Generally, z-scores greater than +2 or less than -2 indicate potential outliers. However, in stricter cases, values beyond ±3 are considered extreme outliers.

Related Articles

How to Use "Center Across Selection" in Excel

How to Count Cells with Text in Excel

How to Remove Hyperlinks in Excel

Want to Make Excel Work for You?ย Try out 5 Amazing Excel Templates & 5 Unique Lessons

We hate SPAM. We will never sell your information, for any reason.