Count If Visible Fields Advice

VBA learner ITG

Board Regular
Joined
Apr 18, 2017
Messages
147
Hi all,

I have this formula which provides a percentage of column B count for a Yes or No answer.

=COUNTIF(B6:B6345,"YES")/COUNTA(B6:B6345)
=COUNTIF(B6:B6345,"NO")/COUNTA(B6:B6345)

I need to know if there is another formula I could amend the above to so it counts visble fields only after i have applied a filter on the column?
 

VBA learner ITG

Board Regular
Joined
Apr 18, 2017
Messages
147
Thank you for reviewing, I have decided to go with the below.

=SUMPRODUCT(SUBTOTAL(3,OFFSET(B6:B6345,ROW(B6:B6345)-ROW(B6),0,1))*(B6:B6345="yes"))/COUNTA(B6:B6345)
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B6:B6345,ROW(B6:B6345)-ROW(B8),0,1))*(B6:B6345="no"))/COUNTA(B6:B6345)
 

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,308
I think you should use a similar formula in the denominator, but excluding the condition ("Yes"), i.e.:
=SUMPRODUCT(SUBTOTAL(3,OFFSET(B6:B6345,ROW(B6:B6345)-ROW(B6),0,1)))

Otherwise, you will be counting all the rows, not just the visible ones.

M.
 

Forum statistics

Threads
1,078,515
Messages
5,340,863
Members
399,396
Latest member
PBE

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top