How to average non-adjacent/contiguous cells excluding zeroes in Excel?
Supposing you have a fruit table as the right screenshot shown, and you need to calculate the average of all cells in the Quantity columns excluding the zeroes, how to get it done? The following methods can help you.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
The following formula we will recommend can just work on non-adjacent cells in a single row. For example, you need to calculate the average of three date’s quantity of Apple excluding zero cells in the table, you can apply the following formula.
1. Select a blank cell, enter formula =AVERAGE(IF(MOD(COLUMN(C2:G2)-COLUMN(C2),2)=0,IF(C2:G2,C2:G2))) into the Formula Bar, and then press the Ctrl + Shift + Enter keys simultaneously.
Note: In the formula, C2 and G2 are the first and last cells of the non-adjacent cells. And number 2 in the formula means there is only one column interval between every non-adjacent cell. You can change them based on your needs.
If the non-adjacent cells do not locate in a single row, for example you need to calculate the average of all fruit’s quantities excluding zero cells, you can try the following method.
|Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.|
1. Select the table which begins with the first non-adjacent column data you will include in your calculation. In this case, we select range C2:G7. Then click Kutools > Select > Select Interval Rows & Columns. See screenshot:
2. In the Select Interval Rows & Columns dialog box, select Columns in the Select section, and in the Options section, enter number 1 separately in the Interval of and Columns box, and then click the OK button.
Note: For the Interval of box, please enter the interval number based on the interval of your non-adjacent cells.
3. After clicking the OK button, all non-adjacent cells in selected range are selected immediately. For excluding the zero cells while calculating the average, please go ahead to click Kutools > Select > Select Specific Cells. See screenshot:
4. In the Select Specific Cells dialog box, please select Cell option in the Selection type section, then select Does not equal option and enter number 0 into the following textbox in the Specific type section. And finally click the OK button.
5. Then a dialog box will pop up to tell you how many cells are selected, please click the OK button. Now all non-adjacent cells in specified range are selected excluding all zero cells, and you can see the average result displays on the Status Bar of the workbook.