Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Count If query within string

Hi all,

I am trying to count a word within a range of cells. Some cells may contain
the word within a text string for example:
Count the word "red" within "red 1", "red 2", "red 3" etc.
I know this can be done with the formula..."=CountIf(range, "*red*")"

The real question is if this is possible to search by a cell value?
ie. If cell "A1" equals "red" then count "red", if "A1" equals "blue" then
count the number of times "blue" appears.

Hope this makes sense. Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Count If query within string

=COUNTIF(range,"*"&A1&"*")

--
__________________________________
HTH

Bob

"JohnH" wrote in message
...
Hi all,

I am trying to count a word within a range of cells. Some cells may
contain
the word within a text string for example:
Count the word "red" within "red 1", "red 2", "red 3" etc.
I know this can be done with the formula..."=CountIf(range, "*red*")"

The real question is if this is possible to search by a cell value?
ie. If cell "A1" equals "red" then count "red", if "A1" equals "blue" then
count the number of times "blue" appears.

Hope this makes sense. Thank you.



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
Passing Query String into MS Excel napval Excel Discussion (Misc queries) 0 June 19th 07 06:04 AM
Get Query String from Access RichardSchollar Excel Programming 1 January 24th 07 12:33 AM
MS Query DateTime String Dean Excel Worksheet Functions 1 January 23rd 06 12:07 PM
Querying 2 databases with one query string Ben Latham Excel Discussion (Misc queries) 0 October 25th 05 09:17 PM
Syntax for ADO Query String John Excel Programming 1 January 17th 05 08:49 AM


All times are GMT +1. The time now is 12:03 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"