Filtering to a Standard Deviation

Written by Allen Wyatt (last updated January 1, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

Tom has a data set that shows the daily high and low temperatures for his town. He knows how to determine the mean for the data set. What he needs, though, is to filter the data set so that only those values that are within one standard deviation of the mean are visible.

First of all, let's say that Tom's dataset includes the temperatures for a ten-year period, from 2011 through 2020. That represents 3,653 days of temperatures. Further, let's assume that the high temperatures are in a range named DailyHighs and the low temperatures are in a range named DailyLows. To calculate the average (mean) for the high temperatures, this simple formula is used:

=AVERAGE(DailyHighs)

Excel provides three different functions for calculating standard deviations: STDEV, STDEV.S, and STDEV.P. In most cases you'll use STDEV and STDEV.S; they both return the exact same values. (STDEV.S and STDEV are used when working with a sample of an entire population of data points, whereas STDEV.P is used when working with an entire population. For Tom's purposes, STDEV or STDEV.S will work just fine.) Thus, to calculate one standard deviation below the mean and one above, you would use two formulas:

=AVERAGE(DailyHighs)-STDEV(DailyHighs)
=AVERAGE(DailyHighs)+STDEV(DailyHighs)

This provides the bounds for the filtering that Tom wishes to perform. For the sake of example, let's say that the low value is 49.477 and the high value is 90.576. It is just a simple process, at this point, to create a filter that uses these values:

  1. Select a cell in the column that contains the daily high temperatures.
  2. Display the Data tab of the ribbon.
  3. Click the Filter tool. Excel places filtering drop-down arrows at the sides of the first-row headings in your data.
  4. Click the down-arrow next to the header for the high-temperatures column. Excel displays a filtering dialog box.
  5. In the Filter area, click on the Choose One drop-down list and choose Between. Excel expands the filtering area to allow specification of the two boundary values.
  6. Next to Greater Than or Equal To, enter your lower boundary (49.477).
  7. Next to Less Than or Equal To, enter your upper boundary (90.576).
  8. Click in the Excel worksheet to dismiss the filtering dialog box.

The result is that your data is filtered to only display those rows that are between the two temperatures. If you prefer—and if you are using the version of Excel provided with Microsoft 365—you could also use the FILTER function to extract the records that fit your criteria:

=FILTER(A2:C3654,(DailyHighs>=49.477) * (DailyHighs<=90.576),"")

The extracted rows will not be formatted, nor will it contain the column headings in row 1, but you can easily make these adjustments in the extracted data.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12735) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Floating Information in a Frozen Row

You can freeze information in rows or columns using one of the built-in features of Excel. As you move up or down in the ...

Discover More

Selecting Text in Linked Text Boxes

Text boxes are often used as design elements in a document layout. If you have linked text boxes, you may have noticed ...

Discover More

Cleaning Up a Document that Mixes Styles with Direct Formatting

Need to get rid of direct, explicit formatting applied to a document? Here's an easy way to do it using familiar Word tools.

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Counting Unique Values with Functions

Using Excel to maintain lists of information is not unusual. When working with the list you may need to determine how ...

Discover More

Summing Only the Largest Portion of a Range

Given a range of cells, you may at some time want to calculate the sum of only the largest values in that range. Here is ...

Discover More

Counting Alphabetic Characters in a String

Need to find out how many times a certain letter appears in a text string? It's easy to do if you rely on the SUBSTITUTE ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 5?

2022-01-05 03:53:16

Jacques Raubenheimer

Another method is to use the STANDARDIZE function in a helper column to calculate the Z-score (or standardised score) for each daily temperature (using the average and the standard deviation as described above). Once he has those, it is a simple matter to filter for those values with a z-score >= -1 and <= 1 to find those within one standard deviation of the mean.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.