• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Extract Specific text from a cell

Ady Zavala

New Member
Hello.
I am trying to extract 2 specific words from a list.
As you can see, in Colum B, I have a list with names. In this list, there are 2 key words I am looking for: HRG and Elite.

1755275023584.png
In E1 and G1, I would like to show how many HRG and ELITE are there is total:
In other words, from list in column B, I need to know how many are there with the word "HRG" and how many "Elite" there are.

1755275035215.png
At the end it should look like this:
1755278900999.png
Is it possible to be done?

Thank you so much in advance.
 

Attachments

Does it have to be vba?
In cell E1:
=SUM(--ISNUMBER(SEARCH("HRG",B3:B12)))
This is a case-insensitive search, for a case-sensitive version change SEARCH to FIND
Depending on your version of Excel, you may have to commit this formula to the cell with Ctrl+Shift+Enter rather than the usual Enter.
The ELITE count would be in cell G1:
=SUM(--ISNUMBER(SEARCH("ELITE",B3:B12)))

If you have a more recent version of Excel you can use REGEXTEST and it will give a more correct result (it won't count elite in preliterate):
SUM(--REGEXTEST(B3:B12,"\bELITE\b",1))
which is case-insensitive, to make it case-sensitive, change the 1 to a 0.
 
Last edited:
I have tried
=SUM(--ISNUMBER(SEARCH("HRG",B3:B12)))
=SUM(--ISNUMBER(SEARCH("ELITE",B3:B12)))

=SUM(--ISNUMBER(FIND("HRG",B3:B12)))
=SUM(--ISNUMBER(FIND("ELITE",B3:B12)))

and none worked.

It is not necessary to be VBA.
 
Back
Top