How to Calculate Excel Average Only When No Cells Are Blank
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.

- 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.
Ensure that your intended blank cells are genuinely empty; hidden space characters or formulas returning non-blank strings will cause the formula to miscalculate.
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.
Click on the cell where you want the calculated average to be displayed.
Type the formula `=IF(COUNTBLANK(B1:B5)>0,"",AVERAGE(B1:B5))` into the formula bar, replacing 'B1:B5' with your actual data range.
Press the Enter key to execute the formula. If any cell in the range is blank, the result cell will remain blank.

Clean Data to Remove Hidden Characters
If the formula calculates an average even though a cell appears empty, you may need to clear hidden spaces or zeros.
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. Open Your Data File: Launch WPS Spreadsheet and open the workbook containing the dataset.
- 2. Input the Logic Formula: Click on your target cell and input `=IF(COUNTBLANK(B1:B5)>0,"",AVERAGE(B1:B5))`.
- 3. Press Enter to Calculate: Hit Enter. WPS Spreadsheet will instantly process the formula and return a blank if missing values exist.

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.




