Visible filed in filter data how to use countif

marko80m

New Member
Joined
Apr 21, 2013
Messages
6
Can someone explain me how to implement countif function(more criteria) on filter data. This formula is not ok
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B2:B50,ROW(B2:B50)-MIN(ROW(B2:B50)),,1))*(B2:B50="Quality")) because there is a mistake in offset!
I have
Firm A B C D
1
.
.
.
800 800 800 800 800
I use filter to select couple of firm
Than from column A I want firms that A>=0,4 that is not problem in all data but in filter is problem.
From second column I want firm that meet first criteria and that is filed second criteria B is between 0,3 and 0,4!
=COUNTIFS(Sheet2!$A$3:$A$813;">=0,4";Sheet2!B3:B813;">=0,3";Sheet2!B3:B813;"<0,4") this formula not works in filter data.
Can someone help me!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Say your data is like this

A B C[TABLE="width: 144"]
<tbody>[TR]
[TD="class: xl63, width: 64, bgcolor: transparent"]Firm
[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent"]Header1
[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent"]Header2
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm1
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,5
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,1
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm2
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,5
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,38
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm3
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,1
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,3
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm4
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,7
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,35
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm5
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,6
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,5
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm6
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,2
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,6
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm7
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,6
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,4
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm8
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,8
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,2
[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]Firm9
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,1
[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]0,9
[/TD]
[/TR]
</tbody>[/TABLE]

And you filter selecting Firms 2, 3, 4, 6, 7 and 8 getting this

A B C
[TABLE="width: 144"]
<tbody>[TR]
[TD="class: xl65, width: 64, bgcolor: transparent"]Firm
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"]Header1
[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"]Header2
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]Firm2
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,5
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,38
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]Firm3
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,1
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,3
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]Firm4
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,7
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,35
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]Firm6
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,2
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,6
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]Firm7
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,6
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,4
[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]Firm8
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,8
[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]0,2
[/TD]
[/TR]
</tbody>[/TABLE]

To count column B >= 0.4 try this
=SUMPRODUCT(--(SUBTOTAL(3,OFFSET($A$2:$A$10,ROW($A$2:$A$10)-ROW($A$2),0,1))),--($B$2:$B$10>=0.4))
that returns 4

To count column B >= 0.4 AND column C between 0.3 and 0.4 try
=SUMPRODUCT(--(SUBTOTAL(3,OFFSET($A$2:$A$10,ROW($A$2:$A$10)-ROW($A$2),0,1))),--($B$2:$B$10>=0.4),--($C$2:$C$10>=0.3),--($C$2:$C$10<=0.4))
that returns 3

Hope this is what you need

M.
 
Last edited:
Upvote 0
Marcelo,
But this formula is not working on my computer. OFFSET is flash and need some corrections. Data are organized just as you presented them above.
I hope someone can explain to me what is wrong and why?
=SUMPRODUCT(--(SUBTOTAL(3,OFFSET($A$3:$A$813,ROW($A$3:$A$813)-ROW($A$3),0,1))),--($C$3:$C$813>=0,4),--($G$3:$G$813>=0,3),--($G$3:$G$813<0,4))
 
Upvote 0
It should work.

What Excel version are you using? Is it an US version?

Maybe you need to change the argument separator from "," to ";" (trying to guess...)

M.
 
Upvote 0
It should work.

What Excel version are you using? Is it an US version?

Maybe you need to change the argument separator from "," to ";" (trying to guess...)

M.

I use Excel 2010 Europe(Serbia) and try both formula
=SUMPRODUCT(--(SUBTOTAL(3,OFFSET($A$3:$A$813,ROW($A$3:$A$813)-ROW($A$3),0,1))),--($D$3:$D$813>=0.4),--($E$3:$E$813>=0.3),--($E$3:$E$813<=0.4)
=SUMPRODUCT(--(SUBTOTAL(3;OFFSET($A$3:$A$813;ROW($A$3:$A$813)-ROW($A$3);0;1)));--($D$3:$D$813>=0,4);--($E$3:$E$813>=0,3);--($E$3:$E$813<=0,4)
and of course You are right formula is working but I have another problem:
In some column I have #DIV/0! and formula is not working is it possible, because obvious you are expert, to correct this thing!
In any case, I am very grateful! [TABLE="width: 71"]
<colgroup><col width="71"></colgroup><tbody>[TR]
[TD="class: xl65, width: 71, align: center"][/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="width: 694"]
<colgroup><col><col span="2"><col><col><col><col><col><col span="2"></colgroup><tbody>[TR]
[TD="colspan: 10"][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 684"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Try to correct your data wrapping the formula with IFERROR (Excel 2007 or higher)

For example if you have
=A1/B1
and B1=0 it results in #DIV/0!

So use this
=IFERROR(A1/B1;"")

You should correct the data not the SUMPRODUCT formula

M.
 
Upvote 0
Marcelo,
I have another problem related to the calculation of absolute numbers. I wish to be -0.3 and 0.3 are counted as 0.3 on how this turned into a excel.
Hoping to help me, and with this...
=SUMPRODUCT(--(SUBTOTAL(3;OFFSET($A$3:$A$813;ROW($A$3:$A$813)-ROW($A$3);0;1)));--($D$3:$D$813>=0,4);--($E$3:$E$813>=0,3);--($E$3:$E$813<=0,4)
A B C
[TABLE="class: cms_table, width: 144"]
<tbody>[TR]
[TD="class: cms_table_xl65, width: 64, bgcolor: transparent"]Firm[/TD]
[TD="class: cms_table_xl65, width: 64, bgcolor: transparent"]Header1[/TD]
[TD="class: cms_table_xl65, width: 64, bgcolor: transparent"]Header2[/TD]
[/TR]
[TR]
[TD="class: cms_table_xl65, bgcolor: transparent"]Firm2[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,5[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]-0,38
[/TD]
[/TR]
[TR]
[TD="class: cms_table_xl65, bgcolor: transparent"]Firm3[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,1[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,3[/TD]
[/TR]
[TR]
[TD="class: cms_table_xl65, bgcolor: transparent"]Firm4[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,7
[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,35[/TD]
[/TR]
[TR]
[TD="class: cms_table_xl65, bgcolor: transparent"]Firm6[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,2[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]-0,6
[/TD]
[/TR]
[TR]
[TD="class: cms_table_xl65, bgcolor: transparent"]Firm7[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,6[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,4[/TD]
[/TR]
[TR]
[TD="class: cms_table_xl65, bgcolor: transparent"]Firm8[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,8[/TD]
[TD="class: cms_table_xl65, bgcolor: transparent, align: right"]0,2


[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Maybe...

=SUMPRODUCT(--(SUBTOTAL(3;OFFSET($A$3:$A$813;ROW($A$3:$A$813)-ROW($A$3);0;1)));--($D$3:$D$813>=0.4);--(ABS($E$3:$E$813)>=0.3);--(ABS($E$3:$E$813)<=0.4))

M.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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