Forum

Notifications
Clear all

Count calculation + text search

3 Posts
2 Users
0 Reactions
88 Views
(@usb)
Posts: 244
Honorable Member
Topic starter
 
Hi, in the attached file which is just an example - in column A there are answers I received to the questionnaire.
 In the report on the side I need him to look for the word Cousult
 in a column and count how many times it is written.
I will note that the word counsel is written within a sentence.
 How do you do it??
 In my work file there are 20 comments and I can't search them manually one by one.. 
Thank you very much...
 
Posted : 21/06/2023 7:10 pm
Alan Sidman
(@alansidman)
Posts: 220
Member Moderator
 

Here is a Macro solution for Consult which you can adapt for your other counts

 

Option Explicit
 
Sub Lea()
    Dim i As Long, lr As Long, x As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    x = 0
    For i = 2 To lr
        If InStr(Range("A" & i), "consult") > 0 Then
            x = x + 1
        End If
    Next i
    Range("C3") = x
End Sub
 
Posted : 21/06/2023 11:02 pm
(@usb)
Posts: 244
Honorable Member
Topic starter
 
Thanks!!!
I need the answer to many cells in the report on the side.
So I would love to understand how to activate the macro and how to get the answer in all the cells. Thanks!!!!

And it is not possible to write this in a normal function in Excel? Why do you need a macro code?

If you could send me the answer in the file, it would help me a lot, thanks!!!
 
 
Posted : 21/06/2023 11:07 pm
Share: