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

Jack032

New Member
Joined
Jul 30, 2018
Messages
4
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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top