Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear All,
I need to search & record the number times the text appears in a paragraph. I need to use the Find function (in my scenario) Any help out there? Thank you. Regards, Julian |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Where is your paragraph stored? If it is all in one cell eg A1 then
enter the text you are serching for in B1 and then in any cell enter the formula: =(LEN(A1)-LEN(SUBSTITUTE(A1,B1,"")))/LEN(B1) Hope this helps Rowan wrote: Dear All, I need to search & record the number times the text appears in a paragraph. I need to use the Find function (in my scenario) Any help out there? Thank you. Regards, Julian |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, the text may appear in several cells in the sheet. That is why I
need to use the FIND function. Regards, Julian Rowan wrote: Where is your paragraph stored? If it is all in one cell eg A1 then enter the text you are serching for in B1 and then in any cell enter the formula: =(LEN(A1)-LEN(SUBSTITUTE(A1,B1,"")))/LEN(B1) Hope this helps Rowan wrote: Dear All, I need to search & record the number times the text appears in a paragraph. I need to use the Find function (in my scenario) Any help out there? Thank you. Regards, Julian |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe like this but it will only find the number of cells that contain
the text, so if you have one cell that contains the text 5 times that will only be counted as 1. Sub FindAll() Dim Found As Integer Dim c As Range Dim firstAddress As String Const findText As String = "dog" 'text to find With Worksheets(1).Range("a1:f500") 'set range and sheet Set c = .Find(findText, LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do Found = Found + 1 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With MsgBox "Found " & Found & " instances of " & findText End Sub Regards Rowan wrote: Hi, the text may appear in several cells in the sheet. That is why I need to use the FIND function. Regards, Julian Rowan wrote: Where is your paragraph stored? If it is all in one cell eg A1 then enter the text you are serching for in B1 and then in any cell enter the formula: =(LEN(A1)-LEN(SUBSTITUTE(A1,B1,"")))/LEN(B1) Hope this helps Rowan wrote: Dear All, I need to search & record the number times the text appears in a paragraph. I need to use the Find function (in my scenario) Any help out there? Thank you. Regards, Julian |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That was quick. Worked like a charm. Thanks a million
regards, Julian |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's a shorter version
Sub CountCells() Dim findText as String, found as Long findText = "dog" Found = application.Countif(worksheets(1).Range("A1:Z26"), _ "*" & findText & "*") MsgBox "Found " & Found & " instances of " & findText End sub -- Regards, Tom Ogilvy wrote in message oups.com... That was quick. Worked like a charm. Thanks a million regards, Julian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count number times text appears in string | Excel Discussion (Misc queries) | |||
Count the number of times specific text appears in a column | Excel Worksheet Functions | |||
Counting the times a number appears | Excel Discussion (Misc queries) | |||
count number of times text appears | Excel Discussion (Misc queries) | |||
How do I count the number of times a value appears? | Excel Worksheet Functions |