Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SEARCH but for cell contents rather than text Matt D Francis Excel Discussion (Misc queries) 2 October 29th 09 02:45 PM
Can I search for the displayed value in a cell, not the contents? Eric_NY Excel Discussion (Misc queries) 2 July 14th 09 04:19 PM
search if cell contents exist in other cells CharileBaker Excel Worksheet Functions 1 April 12th 07 11:00 AM
Search and Edit cell contents Zooropa Excel Programming 0 July 26th 06 09:34 AM
Search Cell Contents Between || [email protected][_2_] Excel Programming 2 March 10th 06 04:33 PM


All times are GMT +1. The time now is 07:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"