Function Problems

How to Use AVERAGEIF Across Multiple Ranges Ignoring Zero and N/A

Khadija KhanKhadija Khan Nov 10, 2026 869 views

Question details

The user needs to calculate the average of ratings located in non-contiguous cells or multiple ranges, specifically excluding any zero (0) values and 'N/A' text entries.

How to Average Across Multiple Ranges While Ignoring Zero and N/A
Product
Spreadsheets
Device & OS
not provided
Scenario
Calculating an accurate average rating from scattered data points while filtering out invalid or zero-value entries.
Observed behavior
Standard AVERAGEIF or AVERAGEIFS functions struggle with non-contiguous multiple ranges, requiring a workaround to combine ranges and filter out 0 and 'N/A'.
Before you start

Ensure your spreadsheet software supports dynamic array functions like FILTER, TOCOL, and VSTACK (available in Microsoft 365 and newer spreadsheet versions) before using the advanced formula method.

Solution 1Recommended

Use FILTER and VSTACK to Average Multiple Ranges

Combine multiple ranges into a single array and filter out unwanted values before calculating the average.

Standard AVERAGEIF functions do not natively support multiple non-contiguous ranges. By using dynamic array functions like VSTACK (to combine ranges) and FILTER (to exclude 0 and N/A), you can easily calculate the correct average.

1
Combine ranges with VSTACK

Use the VSTACK function to stack your multiple ranges vertically. For example: =VSTACK(A1:A5, C1:C5).

2
Filter out zeros and N/A

Wrap the stacked array in a FILTER function with conditions to exclude 0 and 'N/A'. Example: FILTER(VSTACK(A1:A5, C1:C5), (VSTACK(A1:A5, C1:C5)<>0) * (VSTACK(A1:A5, C1:C5)<>"N/A")).

3
Calculate the average

Finally, wrap the entire FILTER formula inside the AVERAGE function: =AVERAGE(FILTER(VSTACK(A1:A5, C1:C5), (VSTACK(A1:A5, C1:C5)<>0) * (VSTACK(A1:A5, C1:C5)<>"N/A"))). Press Enter to get the result.

Use FILTER and VSTACK to Average Multiple Ranges
Handling Errors: If the FILTER function returns an error because no values meet the criteria, you can wrap the formula in IFERROR to display a custom message.
Advanced Spreadsheet Functions

Calculate Complex Averages Easily with WPS Spreadsheet

WPS Office provides a powerful, free Spreadsheet tool that supports advanced formulas, making it easy to calculate averages across multiple ranges while filtering out zeros and errors.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook containing the data ranges.
  2. 2. Select the target cell: Click on the cell where you want the final average to appear.
  3. 3. Enter the formula: Type your combined AVERAGE, FILTER, and VSTACK formula, then press Enter to instantly calculate the result.
Fully compatible with Microsoft Excel formulas and functions.Supports advanced data analysis and array calculations.Free, lightweight, and fast to install on Windows, Mac, and Linux.Clean, tabbed interface for managing multiple workbooks easily.
microsoft office alternative - wps office

Frequently Asked Questions

Why does AVERAGEIF return a #VALUE! error with multiple ranges?

The AVERAGEIF and AVERAGEIFS functions are designed to work with a single contiguous range. If you input multiple non-contiguous ranges separated by commas, the function will return an error. You must combine the ranges first using VSTACK/TOCOL or use a SUM/COUNT workaround.

Does the AVERAGE function automatically ignore text like 'N/A'?

Yes, the standard AVERAGE function automatically ignores text strings and empty cells. However, it does include zero (0) values in its calculation. To ignore zeros as well, you must explicitly filter them out before averaging.

What is the TOCOL function used for in this scenario?

The TOCOL function transforms an array or range into a single column. It is useful for flattening a 2D range into a 1D list, making it much easier to filter out zeros and 'N/A' values before passing the data to the AVERAGE function.