logo
search
Formula Errors

How to Calculate Excel Average Only When No Cells Are Blank

Aamir Naveed AkramAamir Naveed Akram Oct 14, 2026 869 views

Question details

The user needs a formula to calculate the average of a range only when every cell in that range contains a value, returning a blank result if any cell is empty.

How to Calculate Excel Average Only When No Cells Are Blank
Product
Excel
Device & OS
not provided
Scenario
Calculating an average across a dataset where complete data is strictly required, skipping the calculation entirely if any data points are missing.
Observed behavior
The standard AVERAGE function automatically ignores blank cells and calculates the average of the remaining numbers, which violates the strict requirement of needing all values present.
Before you start

Ensure that your intended blank cells are genuinely empty; hidden space characters or formulas returning non-blank strings will cause the formula to miscalculate.

Solution 1Recommended

Use the IF and COUNTBLANK Functions Together

Combine the IF and COUNTBLANK functions to check the range for any empty cells before allowing the AVERAGE function to execute.

By nesting the COUNTBLANK function inside an IF statement, you can establish a condition that checks if the count of blank cells is greater than zero. If true, it returns an empty string; otherwise, it calculates the average.

1
Select the Result Cell

Click on the cell where you want the calculated average to be displayed.

2
Enter the Formula

Type the formula `=IF(COUNTBLANK(B1:B5)>0,"",AVERAGE(B1:B5))` into the formula bar, replacing 'B1:B5' with your actual data range.

3
Apply the Formula

Press the Enter key to execute the formula. If any cell in the range is blank, the result cell will remain blank.

Use the IF and COUNTBLANK Functions Together
COUNTBLANK Behavior: The COUNTBLANK function treats both genuinely empty cells and cells containing formulas that return an empty string ("") as blank.
Advanced Spreadsheet Management

Easily Handle Complex Formulas in WPS Spreadsheet

WPS Spreadsheet provides a comprehensive, highly compatible environment for executing complex logic functions like IF, COUNTBLANK, and AVERAGE. It is an ideal, lightweight tool to accurately analyze data and enforce strict calculation rules.

  1. 1. Open Your Data File: Launch WPS Spreadsheet and open the workbook containing the dataset.
  2. 2. Input the Logic Formula: Click on your target cell and input `=IF(COUNTBLANK(B1:B5)>0,"",AVERAGE(B1:B5))`.
  3. 3. Press Enter to Calculate: Hit Enter. WPS Spreadsheet will instantly process the formula and return a blank if missing values exist.
Fully compatible with Microsoft Excel formulas, functions, and file formats (.xlsx).Intuitive and clean user interface for faster data processing.Lightweight, fast, and completely free to use for daily spreadsheet tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel's standard AVERAGE function ignore blank cells?

By default, the AVERAGE function is designed to ignore text and completely blank cells, only summing up the numeric values and dividing by the count of those numbers. This prevents missing data from skewing the average downwards.

Will a zero (0) be treated as a blank cell by COUNTBLANK?

No, a zero is recognized as a numeric value. COUNTBLANK will not count it as blank, and the AVERAGE function will include the zero in its calculation, which will lower your overall average.

Why is my formula returning an average when a cell clearly looks empty?

The cell most likely contains a hidden space character, a zero formatted to be hidden, or a background formula returning a non-blank hidden value. Select the cell and press the Delete key to ensure it is genuinely blank.

Can I use COUNTIFS instead of COUNTBLANK to check for blanks?

Yes, you can substitute COUNTBLANK with COUNTIFS by using `=IF(COUNTIFS(B1:B5,"")>0,"",AVERAGE(B1:B5))`. However, COUNTBLANK is more direct and generally simpler for this specific scenario.