An Average that Factors In Blank Cells

Written by Allen Wyatt (last updated February 28, 2026)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


2

Liz has a range of numeric values in A5:A22. Some of the cells in the range are blank. In calculating an average of the range, the blank cells are ignored. Liz would like to calculate the average that includes the blank cells, as if they contain a 0 value.

There are a surprisingly large number of approaches you can take to get the average that Liz wants. One easy way is to simply not use the AVERAGE function. Instead, remember that an average is calculated by deriving a sum of the cells divided by the number of cells being summed. Thus, if the range that Liz wants to average is always A5:A22, then this formula will work:

=SUM(A5:A22)/18

If it would be some different range, then the formula could be constructed in this manner:

=SUM(A5:A22)/ROWS(A5:A22)

The key is simply to replace the range referenced in the SUM and ROWS functions with the desired range. This will not work well, though, if some cells in the range could contain text and you don't want those cells factored into the average. In that case, the following variation will work:

=SUM(A5:A22)/(COUNT(A5:A22)+COUNTBLANK(A5:A22))

This works because the COUNT function returns a count of cells containing numeric values and COUNTBLANK returns, well, cells containing blanks. In other words, any cells containing text are ignored.

You could also employ the IF function in your formula, as is done in these four closely related formulas:

=AVERAGE(IF(A5:A22=0,0,A5:A22))
=AVERAGE(IF(A5:A22="",0,A5:A22))
=AVERAGE(IF(LEN(A5:A22)=0,0,A5:A22))
=AVERAGE(IF(A5:A22="",0,IFERROR(--A5:A22,"")))

If you are sure that your cells won't contain any text values, then you can use either of the following:

=AVERAGE(A5:A22 * 1)
=AVERAGE(A5:A22 + 0)

These work because the math operation intrinsic to the formula will always return a numeric value, even if the cell is blank. If you are using Excel 2019 or earlier, then these functions must be entered using Ctrl+Shift+Enter.

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

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

Understanding the Organizer

The Organizer is a great tool for, well, organizing the information stored in your templates. This tip introduces the ...

Discover More

Changing the Color of a Cell Border

Excel provides a variety of tools you can use to make your data look more presentable on the screen and on a printout. ...

Discover More

Automatically Adding Tabs in Footnotes

When you add a footnote to a document, Word's normal formatting adds a space after the footnote number and before the ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Transposing and Linking

Sometimes it is helpful to look at data that is rotated 90 degrees. Excel allows you to use Paste Special to transpose ...

Discover More

Links between Two Desktop Workbooks

If you have formulas that reference values in an external workbook and that workbook is closed, Excel may generate ...

Discover More

Automatically Numbering Rows

Adding row numbers to a column of your worksheet is easy; you just need to use a formula to do it. Here's a quick look at ...

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 8 - 7?

2026-02-28 12:03:02

Mike H

Why not use
=AVERAGEIF(A5:A22, "<>0") to ignore zeros
or
=AVERAGEIFS(A1:A10,A1:A10,"<>0") to ignore zeros and cells containing text


2026-02-28 09:46:14

J. Woolley

Here's another one similar to the Tip's last two formulas:
=AVERAGE(--A5:A22)


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.