Change SUMIF and CHANGIF formulas so that filtered data only gets calculated.

bored622

New Member
Joined
Mar 2, 2022
Messages
43
Office Version
  1. 2016
Platform
  1. Windows
Hello, I currently have these formulas that calculate data from another tab's table, but if I filter data out of the table, my formulas still calculate the filtered out data. I'm pretty new to excel, but I've read a few forums on using SUMPRODUCT to get the results I want but not sure how to do it. Below I have posted a few formulas. If anyone can help, it would be greatly appreciated.

=COUNTIF(USSW1!$V$7:$V$25000,465)

=SUMIF(USSW1!$V$7:$V$25000,"465",USSW1!$O$7:$O$25000)-SUMIFS(USSW1!$O$7:$O$25000,USSW1!$M$7:$M$25000,"FP",USSW1!$V$7:$V$25000,"465")

=COUNTIFS(USSW1!$V$7:$V$25000,"465",USSW1!$M$7:$M$25000,"FP")

=SUMIF(USSW1!$V$7:$V$25000,"465",USSW1!$O$7:$O$25000)-SUMIFS(USSW1!$O$7:$O$25000,USSW1!$M$7:$M$25000,"CA",USSW1!$V$7:$V$25000,"465")-SUMIFS(USSW1!$O$7:$O$25000,USSW1!$M$7:$M$25000,"CF",USSW1!$V$7:$V$25000,"465")

=SUMIF(USSW1!$V$7:$V$25000,"465",USSW1!$O$7:$O$25000)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi & welcome to MrExcel.
I would add a helper column to the USSW1 sheet with this formula
Excel Formula:
=SUBTOTAL(3,A7)
change the A7 to a column that will always have data.
Then you can use you existing formulae with a minor change.
Excel Formula:
=SUMIFS(USSW1!$O$7:$O$25000,USSW1!$V$7:$V$25000,"465",USSW1!$Z$7:$Z$25000,1)
Excel Formula:
=COUNTIFS(USSW1!$V$7:$V$25000,465,USSW1!$Z$7:$Z$25000,1)
changing the Z column to the one with the subtotal formula.
And similar changes to your other formulae
 
Upvote 0
Hi & welcome to MrExcel.
I would add a helper column to the USSW1 sheet with this formula
Excel Formula:
=SUBTOTAL(3,A7)
change the A7 to a column that will always have data.
Then you can use you existing formulae with a minor change.
Excel Formula:
=SUMIFS(USSW1!$O$7:$O$25000,USSW1!$V$7:$V$25000,"465",USSW1!$Z$7:$Z$25000,1)
Excel Formula:
=COUNTIFS(USSW1!$V$7:$V$25000,465,USSW1!$Z$7:$Z$25000,1)
changing the Z column to the one with the subtotal formula.
And similar changes to your other formulae
I went back and changed all my formulas to sumproducts. Would there be a way to exclude filtered data using these formulas?

=SUMPRODUCT(--(USSW1!$V$7:$V$50000="465"))

=SUMPRODUCT(--(USSW1!$V$7:$V$10000="465"),--(USSW1!$O$7:$O$10000),--(USSW1!$M$7:$M$10000="CA")--(USSW1!$M$7:$M$10000="CF"))

=SUMPRODUCT(--(USSW1!$M$7:$M$5016="FP"),--(USSW1!$V$7:$V$5016="465"))

=SUMPRODUCT(--(USSW1!$V$7:$V$10000="465"),--(USSW1!$M$7:$M$10000="FP"),--(USSW1!$O$7:$O$10000))

=SUMPRODUCT(--(USSW1!V7:V5016="465"),--(USSW1!O7:O5016))
 
Upvote 0
Solution
Did you try what I suggested?
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: How to exclude filtered cells from table when using SUMPRODUCT
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Did you copy/paste the formulae I suggested, or modify your own?
 
Upvote 0
Did you copy/paste the formulae I suggested, or modify your own?
Yeah, but these two formulas are giving me issues whenever I try to input the extra column.

=SUMIF(USSW1!$V$7:$V$25000,"465",USSW1!$O$7:$O$25000)-SUMIFS(USSW1!$O$7:$O$25000,USSW1!$M$7:$M$25000,"FP",USSW1!$V$7:$V$25000,"465")-SUMIFS(USSW1!$O$7:$O$25000,USSW1!$M$7:$M$25000,"BK",USSW1!$V$7:$V$25000,"465")

=SUMIF(USSW1!$V$7:$V$25000,"465",USSW1!$O$7:$O$25000)-SUMIFS(USSW1!$O$7:$O$25000,USSW1!$M$7:$M$25000,"CA",USSW1!$V$7:$V$25000,"465")-SUMIFS(USSW1!$O$7:$O$25000,USSW1!$M$7:$M$25000,"CF",USSW1!$V$7:$V$25000,"465")
 
Upvote 0
You will need to change the SUMIF to SUMIFS as SUMIF does not allow more than one criteria.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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