Count iterations of a letter excluding other characters

jl2509

Board Regular
Joined
Oct 30, 2015
Messages
198
Office Version
  1. 365
Platform
  1. Windows
Hi all,

In column A, I have codes allocated as the letter A and B for up to 5 iterations per cell (but could be more I guess dependent on growth). These are separated by "/" but I dont want to count this

How do I count the number of iterations the letters are used in the column starting from Cell A10: A110

The count in Cell A3 should be the total number of "A" in Cell A4 the total Number of "B" and in Cell A5 the sum total of "A" and "B"

i.e. in Column A

Cell A3 Count for "A": 26
Cell A4 Count for "B": 27
Cell A5 sum of "A" and "B": 33

A
A/A
A/A/A
A/A/A/A
B
B/B
B/B/B
B/B/B/B
A/B
A/B/B
A/B/B/B
A/B/B/B/B
B/A
B/A/A
B/A/A/A
B/A/A/A/A
B/B/A/A/B

etc

Thanks in advance.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
How about this.
If A1 contains A/A/A . Enter in B1 = LEN(A1) - LEN(SUBSTITUTE(A1, "A", ""))
 
Upvote 0
How about this.
If A1 contains A/A/A . Enter in B1 = LEN(A1) - LEN(SUBSTITUTE(A1, "A", ""))
Thanks for the response, but sorry, I don't see how that works?

I cant put data in column B as that already contains data

Also the range is A10:A100 for the combinations?

Sample data below

1708943879613.png
 
Upvote 0
Sorry,

So in A3 enter ="A=" & SUMPRODUCT(LEN(A10:A26) - LEN(SUBSTITUTE(A10:A26, "A", "")))

 
Upvote 0
That's works great thanks so much
Is there an option to make this fool proof in case anyone uses a lowercase a or b
 
Upvote 0
="A=" & SUMPRODUCT(LEN(PROPER(A1:A21)) - LEN(SUBSTITUTE(PROPER(A1:A21), "A", "")))
 
Upvote 1
You don't really need the first PROPER there as LEN won't be affected by case. ;)
 
Upvote 0
Much appreciated folks,
Can you provide an example of not using the first Proper please?
 
Upvote 0
I think RoryA meant this

="A=" & SUMPRODUCT(LEN(A1:A21) - LEN(SUBSTITUTE(PROPER(A1:A21), "A", "")))
 
Upvote 0
Thanks for the update. another issue has just come to light, in that if a user inputs data without formatting correctly i.e. "aa" or "AAA" without a "/" the formula counts incorrectly. Can this be updated to include lowercase and poor formatting please. Sorry for the lack of definition in the original requirement, but its only through testing that you realise these things.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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