Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search cell contents
Hello,
I have a list of text data in excel (circa 5,000 rows of text) and I want to search through each cell and count the number of times a certain phrase occures. For example: Search "ilk" from the following lis, only looking in col A: (where "-" indicates seperate columns) Col A - Col B milk - ilk silk - data water - crunch wine - bite which gives a result of "2". I can do the loop and counter etc but dont know what to use to look into each cell for the contents. ie: in psuedo code need a hand with "if cell contents = "ilk"" While "cell in row a" has contents do if cell contents = "ilk" then counter = counter +1 next cell loop. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search cell contents
You can either use the Like operator or use the Instr function:
If Cell.Value Like "*ilk*" Then... If Instr(1,Cell.Value,"ilk")0 Then ... obviously replace Cell with whatever rng object ref you have. Richard kaiser wrote: Hello, I have a list of text data in excel (circa 5,000 rows of text) and I want to search through each cell and count the number of times a certain phrase occures. For example: Search "ilk" from the following lis, only looking in col A: (where "-" indicates seperate columns) Col A - Col B milk - ilk silk - data water - crunch wine - bite which gives a result of "2". I can do the loop and counter etc but dont know what to use to look into each cell for the contents. ie: in psuedo code need a hand with "if cell contents = "ilk"" While "cell in row a" has contents do if cell contents = "ilk" then counter = counter +1 next cell loop. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search cell contents
Thank you very much - worked perfectly
RichardSchollar wrote: You can either use the Like operator or use the Instr function: If Cell.Value Like "*ilk*" Then... If Instr(1,Cell.Value,"ilk")0 Then ... obviously replace Cell with whatever rng object ref you have. Richard kaiser wrote: Hello, I have a list of text data in excel (circa 5,000 rows of text) and I want to search through each cell and count the number of times a certain phrase occures. For example: Search "ilk" from the following lis, only looking in col A: (where "-" indicates seperate columns) Col A - Col B milk - ilk silk - data water - crunch wine - bite which gives a result of "2". I can do the loop and counter etc but dont know what to use to look into each cell for the contents. ie: in psuedo code need a hand with "if cell contents = "ilk"" While "cell in row a" has contents do if cell contents = "ilk" then counter = counter +1 next cell loop. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SEARCH but for cell contents rather than text | Excel Discussion (Misc queries) | |||
Can I search for the displayed value in a cell, not the contents? | Excel Discussion (Misc queries) | |||
search if cell contents exist in other cells | Excel Worksheet Functions | |||
Search and Edit cell contents | Excel Programming | |||
Search Cell Contents Between || | Excel Programming |