Count Visible Cells Only

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have formula in Col B below thast returns a blank if an error is returned

Code:
=IFERROR(LEFT(A1, SEARCH("VAT", A1) - 2),"")

I need a fortmula to count only the visivle items, but my formula is count the non-visible item, where the formula above generates a blank if thee is an error. I want these cells to be ignored

Code:
=COUNTIF(B1:B33,"<>")
Kinddly amend my formula
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Your heading is a bit misleading. Visible cells normally refers to having filtered rows so that they are not visible which doesn't seem to be the case here.

Your first formula seems to be stripping out the VAT rate from the text but you are left with a text value instead of a numeric value. The below gives you an alternative in Column C as well as a count non-blanks formula.
Note: CountIfs, SumIfs etc only treat empty cells as meeting the criteria "<>" and do not consider "" as being empty.

Book1
ABCDEFG
110 VAT1010
220 VAT2020Count Col BCount Col C
3  Count -->33
450 VAT5050
5  
6  
7  
Sheet1
Cell Formulas
RangeFormula
B1:B7B1=IFERROR(LEFT(A1, SEARCH("VAT", A1) - 2),"")
C1:C7C1=IFERROR(VALUE(LEFT(A1, SEARCH("VAT", A1) - 2)),"")
F3F3=COUNTA(FILTER($B$1:$B$33,$B$1:$B$33<>""))
G3G3=COUNTA(FILTER($C$1:$C$33,$C$1:$C$33<>""))
 
Upvote 0
Solution
I don't know what the actual data is like, but a simpler formula for cell G3 in Alex's set-up would be
Excel Formula:
=COUNT(C1:C33)
 
Upvote 0
Thanks for your input Peter, but your formula returns zero in this instance -see link below

 
Upvote 0
Thanks for your input Peter, but your formula returns zero in this instance -see link below
That is because my formula was prefixed with ..
a simpler formula for cell G3 in Alex's set-up would be
In Alex's set-up, the formula in G3 was counting values in column C and his values in column C were numbers. Yours are not - but we didn't have that information at the time.
With over 6,000 posts I would have thought you would understand the importance of sample data up-front so that helpers know what they are actually dealing with. ;)
 
Upvote 0
You are 100% correct Peter. I should have posted samole data in my 1st post and apologise for not doing so
 
Upvote 0
Wouldn't this formula produce the same result without the need for column B?

Excel Formula:
=COUNTIF(A1:A33,"*??VAT*")
 
Upvote 0
Thanks Peter. You are 100% no need for Column B , using this formula
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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