How to count SPECIFIC text characters with a range of cells

dandeisel

New Member
Joined
Feb 1, 2017
Messages
16
Hey guys,

Can someone assist me in writing a formula for counting how many "I" are in a range of cells. For example I have a range of cells B11:AF12 that have different letters in it to identify the kind of Lead Source we receive. "I" represents Internet. I need to find out how many I's are in that range of cells. Keep in mind there could be multiple I's in a single cell.

Thanks guys!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try this:

Code:
Dim arr, i As Long, j As Long, L1 As Long, L2 As Long

arr = Range("B11:AF12")


For i = LBound(arr, 1) To UBound(arr, 1)
    For j = LBound(arr, 2) To UBound(arr, 2)
        L1 = L1 + Len(arr(i, j))
        arr(i, j) = Replace(LCase(arr(i, j)), "i", "")
        L2 = L2 + Len(arr(i, j))
    Next
Next


MsgBox "Number of character I in the range is " & L1 - L2
 
Upvote 0
You could use:

=SUMPRODUCT(LEN(B11:AF12)-LEN(SUBSTITUTE(B11:AF12,"I","")))
 
Upvote 0
Glad to help. :)
 
Upvote 0
Steve I appreciate you taking the time to do what you did. When I first looked at it. I was like :confused:. LOL
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,765
Members
449,049
Latest member
greyangel23

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