SUM of or AVE of a range that has hidden ROWS

agerrard

Active Member
Joined
Apr 4, 2005
Messages
406
Hi All,

How do you get Excel to only SUM or AVERAGE the rows that remain visible?

I have a filter (1 = yes and 0 = no) so i sorted using the 1 so all the rows that had a 1 in them are showing, but when i go to SUM or AVERAGE the range excel keeps adding the values in the hidden rows as well.

How do i prevent this??

Thanks!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi All,

How do you get Excel to only SUM or AVERAGE the rows that remain visible?

I have a filter (1 = yes and 0 = no) so i sorted using the 1 so all the rows that had a 1 in them are showing, but when i go to SUM or AVERAGE the range excel keeps adding the values in the hidden rows as well.

How do i prevent this??

Thanks!
Try these...

For the average:

=SUBTOTAL(1,A5:A100)

For the sum:

=SUBTOTAL(9,A5:A100)

Adjust the ranges to suit.
 
Upvote 0
Hi

You can use the SUBTOTAL function:

=SUBTOTAL(109,A1:A10) will sum only the visible rows in A1:A10
=SUBTOTAL(101,A1:A10) will give the average of just the visible rows in A1:A10

There are a number of functions available with SUBTOTAL - take a look in the Excel help for the full list.

HTH
DK
 
Upvote 0
Thanks T. That worked a treat.

By the way how does that work??
The SUBTOTAL function was made specifically for filtered data. It does the calculation but ignores the rows hidden by the filter.

It can perform a variety of calculations. See Excel help for descriptions of all the calculations it can perform.
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,217
Members
452,895
Latest member
BILLING GUY

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