VBA to count number of cells with exact text

rbone

New Member
Joined
Aug 19, 2019
Messages
20
Hello,
I'm looking for a VBA script to find the total number of cells in a worksheet with the text "VOIP", but not "VOIP*", and output the count cell "S5"

Any assistance is greatly appreciated.

The following is giving me all instances of VOIP, including VOIP*

Code:
Range("S5").Select
    ActiveCell.FormulaR1C1 = "=COUNTIF(R1C1:R3057C13,""VOIP"")"
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You can use
=SUMPRODUCT((A1:M9997="VOIP")*(SUBTOTAL(103,OFFSET(A1,ROW(A1:A9997)-MIN(ROW(A1:A9997)),0))))

But it will only count cells where col A has a value
 
Upvote 0
You can use
=SUMPRODUCT((A1:M9997="VOIP")*(SUBTOTAL(103,OFFSET(A1,ROW(A1:A9997)-MIN(ROW(A1:A9997)),0))))

But it will only count cells where col A has a value

Thank you, Fluff! That worked perfectly.

I tried following the other threads about SUMPRODUCT and I just couldn't get it right, but with the correct syntax, I can see what I was doing wrong.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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