Using Count Formula in a Range

ConfusedExcelGuy

New Member
Joined
Jul 16, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I am using a VLOOKUP in a range of cells on a table with IFERROR so that only results are visible. I want to count only the results. If I try to use COUNTA or SUBTOTAL I get back the total range count since the formula is in all the cells. Is there a way to count only the cells with visible data (a hit) without copying and pasting the whole range as values?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Since you have MS365 this should work:
Excel Formula:
=SUM(--(A3:A6<>""))
For older versions
Excel Formula:
=SUMPRODUCT(--(A3:A6<>""))
 
Last edited:
Upvote 0
The data in the column is more like a serial number a mixture of letters and numbers with no space between them. It amazes me how difficult this is.
 
Upvote 0
Show us a sample of your data including the row and column references. Did you change the A3:A6 to your actual references ?
What I gave you should work whether it is Text or Numbers ?
 
Upvote 0
Also what is the exact vlookup formula that you are using?
 
Upvote 0
Show us a sample of your data including the row and column references. Did you change the A3:A6 to your actual references ?
What I gave you should work whether it is Text or Numbers ?
Thank you Alex! Was able to get these to work today. Not sure why they wouldn't work yesterday night.

I can leave the formula and count only the visible results.
 
Upvote 0
Also what is the exact vlookup formula that you are using?
How can I count the empty cells only?
The formula is +IFERROR(+VLOOKUP(F7,INDEX!A:A,1,0),"") , where F7 is a column of reference numbers 14 characters long: ####AB####C## , and INDEX is a sheet with a system report.
 
Upvote 0
If you swap the <> for = that should count where the IfError is returning "".
If you want to include in the count where the VLookup is returning "" then you need to change the lookup to
Excel Formula:
=IFERROR(VLOOKUP(F7,INDEX!A:A,1,0) & "", "")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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