Confused: SUMIF combined with SUBTOTAL?

kingofcamden

New Member
Joined
Feb 13, 2015
Messages
13
Dear all,


I am trying to combine SUMIF & AVERAGE with SUBTOTAL to only "SUMIF/AVERAGEIF" visible cells. The formula I use for the SUMIF is:


Code:
=SUMIF(Report_Details!AA14:AA8013,1,Report_Details!F14:F8013)


And for the AVERAGEIF:


Code:
=AVERAGEIF(Report_Details!AA14:AA8013,1,Report_Details!H14:H8013)


However, as soon as I apply a filter to the data stored in the Report_Details sheet, the formulas don't update to only calculate the visible cells.


Does anyone know how this can be solved? Quite complex and I've tried for a while now with now success :(


Hope someone can help.


Many thanks,
Mat
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi Mat

Try:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(Report_Details!AA14:AA8013,ROW(Report_Details!AA14:AA8013)-MIN(ROW(Report_Details!AA14:AA8013)),,1)),--(Report_Details!AA14:AA8013=1),Report_Details!F14:F8013)
 
Upvote 0
Hi.

=SUMPRODUCT(SUBTOTAL(3,OFFSET(Report_Details!AA14,ROW(Report_Details!AA14:AA8013)-MIN(ROW(Report_Details!AA14:AA8013)),)),0+(Report_Details!AA14:AA8013=1),Report_Details!F14:F8013)

and, array formula** this one:

=AVERAGE(IF(SUBTOTAL(3,OFFSET(Report_Details!AA14,ROW(Report_Details!AA14:AA8013)-MIN(ROW(Report_Details!AA14:AA8013)),)),IF(Report_Details!AA14:AA8013=1,Report_Details!F14:F8013)))

Regards


**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
 
Upvote 0
Hiya!

WOW :eek: That's what I call a formula!
Thanks so much - they both work great!!

One last question...hope you can also help with this one. Some of the results come out as #DIV/O! - is there any chance Excel can display a 0 in this case?

Thanks so much!!!
Cheers,
mat
 
Upvote 0
1. Just enter:
Rich (BB code):

=SUMPRODUCT(SUBTOTAL(9,OFFSET(Report_Details!F14,
    ROW(Report_Details!F14:F8013)-ROW(Report_Details!F14),0,1)),
    --(Report_Details!AA14:AA8013=1))
2. Control+shift+enter, not just enter:
Rich (BB code):

=AVERAGE(IF(SUBTOTAL(2,OFFSET(Report_Details!F14,
    ROW(Report_Details!F14:F8013)-ROW(Report_Details!F14),0,1)),
    IF(Report_Details!AA14:AA8013=1,Report_Details!F14:F8013)))
 
Upvote 0
[...]
One last question...hope you can also help with this one. Some of the results come out as #DIV/O! - is there any chance Excel can display a 0 in this case?
[...]

Try to wrap the AVERAGE formula into an IFERROR call...

=IFERROR(AVERAGE(...),0)

followed again by control+shift+enter, not just enter.
 
Upvote 0
Hiya,

I'm so sorry - another stupid question :(

Would it be possible to display all values that equal 100% as value Settings!$C$5 within this formula:

Code:
=IF(M14=Settings!$C$5,Settings!$C$5,SUM(100/G14*M14)/100)

? Try this with the IF function, but doesn't seem to work...

This this should be the last one for today :)

Thanks,
Mat
 
Upvote 0
Hiya,

I'm so sorry - another stupid question :(

Would it be possible to display all values that equal 100% as value Settings!$C$5 within this formula:

Code:
=IF(M14=Settings!$C$5,Settings!$C$5,SUM(100/G14*M14)/100)

? Try this with the IF function, but doesn't seem to work...

This this should be the last one for today :)

Thanks,
Mat

Could you elaborate?
 
Upvote 0
Sure :)

I'm trying to exclude values larger than 99% from the results of this formula:

Code:
[COLOR=#574123]=IF(M14=Settings!$C$5,Settings!$C$5,SUM(100/G14*M14)/100)[/COLOR]

Sometimes I have results higher than 99% and in this case I would like to display the content of cell Settings!$C$5 (which is basically just text saying "Data above 99%").

So basically saying If the value is more than 99% display
Settings!$C$5, if not do this: (M14=Settings!$C$5,Settings!$C$5,SUM(100/G14*M14)/100)

Hope you can help...

Many thanks,
Mat
 
Upvote 0

Forum statistics

Threads
1,216,019
Messages
6,128,311
Members
449,439
Latest member
laurenwydo

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