Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Value within a cell

Hi,

Is there any code to find a phrase (that i enter into cell E1) within a cell.

For example if

B2 holds "The Cat in the hat"
B3 holds "The Cat in the Car"
B4 holds "The Dog in the Bush"
B5 holds "Harry and the monkey"

I want to search for the number of cells that hold the phrase "in the". In
this case that'd be 3

Is it possible to do this?

Thanks in advance

Niko
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Value within a cell

In cell E1:

=COUNT(FIND("in the",B2:B5))

Enter as an array formula (control-shift-enter)

Note that this is case sensitive, and will not match "In the" or "in The"

HTH,
Keith

"N1KO" wrote:

Hi,

Is there any code to find a phrase (that i enter into cell E1) within a cell.

For example if

B2 holds "The Cat in the hat"
B3 holds "The Cat in the Car"
B4 holds "The Dog in the Bush"
B5 holds "Harry and the monkey"

I want to search for the number of cells that hold the phrase "in the". In
this case that'd be 3

Is it possible to do this?

Thanks in advance

Niko

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Value within a cell

=(LEN(B2&B3&B4&B5)-LEN(SUBSTITUTE(B2&B3&B4&B5,"in the","")))/6

--
Gary''s Student - gsnu200903


"N1KO" wrote:

Hi,

Is there any code to find a phrase (that i enter into cell E1) within a cell.

For example if

B2 holds "The Cat in the hat"
B3 holds "The Cat in the Car"
B4 holds "The Dog in the Bush"
B5 holds "Harry and the monkey"

I want to search for the number of cells that hold the phrase "in the". In
this case that'd be 3

Is it possible to do this?

Thanks in advance

Niko

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Value within a cell

This worked but is going to be way too long for the range i need.

Thanks though.

Niko

"Gary''s Student" wrote:

=(LEN(B2&B3&B4&B5)-LEN(SUBSTITUTE(B2&B3&B4&B5,"in the","")))/6

--
Gary''s Student - gsnu200903


"N1KO" wrote:

Hi,

Is there any code to find a phrase (that i enter into cell E1) within a cell.

For example if

B2 holds "The Cat in the hat"
B3 holds "The Cat in the Car"
B4 holds "The Dog in the Bush"
B5 holds "Harry and the monkey"

I want to search for the number of cells that hold the phrase "in the". In
this case that'd be 3

Is it possible to do this?

Thanks in advance

Niko

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Value within a cell

Use this normally entered formula...

=COUNTIF(B2:B5,"*"&E1&"*")

--
Rick (MVP - Excel)


"N1KO" wrote in message
...
Hi,

Is there any code to find a phrase (that i enter into cell E1) within a
cell.

For example if

B2 holds "The Cat in the hat"
B3 holds "The Cat in the Car"
B4 holds "The Dog in the Bush"
B5 holds "Harry and the monkey"

I want to search for the number of cells that hold the phrase "in the". In
this case that'd be 3

Is it possible to do this?

Thanks in advance

Niko




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Value within a cell

Thanks to you all I'll have a go through these in the morning.

Niko
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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Programming 1 August 21st 08 10:13 PM
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON CAPTGNVR Excel Programming 2 July 8th 07 04:18 PM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM


All times are GMT +1. The time now is 01:39 AM.

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

About Us

"It's about Microsoft Excel"