# Averaging non-contiguous columns, while excluding certain cells or rows (Excel 2016)

#### Jack032

##### New Member
While it sounds relatively easy, I am experiencingdifficulty creating a formula to validate the actual result. Within the rangeto be calculated, data includes 0’s, no numbers at all and/or text. For thiscalculation, I started with =AVERAGEIFS(D4:G46,D4:G46,">0",D4:G46,"<>"""),butnoticed it returned an erroneous number. This formula contains the entire data range,but does not exclude row or cells which are part of the result. Therefore itwas modified to=AVERAGEIFS(D4:H12,D4:H12,">0",D4:H12,"<>"""),AVERAGEIFS(D14:H24,D14:H24,">0",D14:H24,"<>"""),butunable to get it working properly. I determined, the ranges were not equal insize. My next step was to try =SUM(D4:D46,G4:G46)/INDEX(FREQUENCY((D4:D46,G4:G46),0),2))but encountered a separate problem. I was unable to add additional criteria anddeal with the unwanted cells/rows. After going back to basics, I was able toget =AVERAGE(D4:D11, G4:G11, D13:D23, G13:G23, D25:D32, G25:G32, D34:D35,G34:G35, D37:D38, G37:G38, D40:D43, G40:G43, D45, G45) to work. However, I havebeen unsuccessful in creating a formula that will be easier to incorporate futurechanges (ie: additional columns)

The data to be averaged is contained within columns D and G, (lines 4 to 46),but must exclude rows 12 (cells D12 and G12), 24, 33, 36, 39, 44 and 46.

Any assistance would be greatly appreciated.

### Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi Jack
Welcome to the board

Assuming (c4:c46,g4:g46) are blank cells, cells with text or cells with numbers, try for the average of the positive numbers in the range:

=AVERAGE(IF(ISNA(MATCH(ROW(D4:D46),{12,24,33,36,39,44,46},0)),IF(N(CHOOSE({1,2},D4:D46,G4:G46))>0,CHOOSE({1,2},D4:D46,G4:G46))))
This is an array formula, you have to confirm it with CTRL-SHIFT-ENTER

Pgc01 - Thank you for the speedy response. ?

Replies
6
Views
268
Replies
4
Views
341
Replies
3
Views
127
Replies
15
Views
510
Replies
1
Views
148

1,203,070
Messages
6,053,365
Members
444,657
Latest member
jessejames1of3

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back