CountIf on visible rows only

DarkJester89

Board Regular
Joined
Nov 5, 2017
Messages
109
Office Version
  1. 2016
Platform
  1. Windows
I have a formula

=COUNTIF(Table1[Column11],10)+COUNTIF(Table1[Column11],11)

Combined countif to look for 10 or 11 in the table

It's on a filtered table, but is there a way to convert this to count only visible rows? I've tried various subtotal formulas but can't get it to work. Thank you in advance.
1681042677763.png
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Yes, you can modify the formula to count only the visible rows by using the SUBTOTAL function instead of the COUNTIF function. The SUBTOTAL function can perform a variety of calculations on a range of cells, including COUNTIF, and it has an option to ignore hidden rows.

Here's the modified formula:

=SUBTOTAL(3,Table1[Column11]=10)+SUBTOTAL(3,Table1[Column11]=11)

In this formula, the first argument of the SUBTOTAL function is set to 3, which corresponds to the COUNTA function. The second argument is the range of cells to count, which is specified using the same syntax as the COUNTIF function. The only difference is that the range is enclosed in parentheses after the equals sign.

The second part of the formula is the same as the first, except that it counts the occurrences of 11 instead of 10.

By using the SUBTOTAL function with the option to ignore hidden rows, this formula will count only the visible rows in the filtered table.

hope this helps
plettieri
 
Upvote 0
How about with a helper column like
Fluff.xlsm
BQ
7Column11IsVisible
8101
1001
1101
1201
1301
14101
15111
34
353
Search
Cell Formulas
RangeFormula
Q8,Q10:Q15Q8=SUBTOTAL(3,[@Column11])
B35B35=SUM(COUNTIFS(Table1[Column11],{10,11},Table1[IsVisible],1))
 
Upvote 0
@plettieri and @Fluff Thank you for the suggestions. I tried both options, but I keep getting stuck where the second table entry isn't recognized and get the following screenshots.

I even tried splitting it as a separate formula for 10 and 11, and also tried manually building the formula to match. In column AL on the workbook, it says its a formula parse error in google sheets.

Is there something I'm doing wrong? Thank you again for your time.

Workbook


1681116364205.png
1681116395162.png
 
Upvote 0
10 OR 11, or rather 10 AND 11 ?
I was trying to go for above 9 to catch anything because it can go higher than 11, but I couldn't figure out the formula to make it match.
10 and 11 would work great though if >9 doesn't work.
 
Upvote 0
What is the name of your table?
 
Upvote 0
I was trying to go for above 9 to catch anything because it can go higher than 11, but I couldn't figure out the formula to make it match.
10 and 11 would work great though if >9 doesn't work.
So the condition >9 is OK ?
 
Upvote 0
Ok how about
Excel Formula:
=COUNTIFS(Table1[Column11],">9",Table1[IsVisible],1)
 
Upvote 0

Forum statistics

Threads
1,215,390
Messages
6,124,670
Members
449,178
Latest member
Emilou

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