Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to search a cell for multiple keywords?

Since the search function only allows one search term at a time, how
can one search a cell for several keywords?

For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.

My apologies if this question already has been addressed, but I didn't
see anything in the archives.

Thank you in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default How to search a cell for multiple keywords?

one way:

=--(SUM(COUNTIF(A1:A100,{"*doc*","*nurs*","*paramed*" }))0)

In article . com,
mr_espresso wrote:

Since the search function only allows one search term at a time, how
can one search a cell for several keywords?

For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.

My apologies if this question already has been addressed, but I didn't
see anything in the archives.

Thank you in advance!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to search a cell for multiple keywords?

Brilliant.

Thanks!

On Apr 27, 6:40 pm, JE McGimpsey wrote:
one way:

=--(SUM(COUNTIF(A1:A100,{"*doc*","*nurs*","*paramed*" }))0)

In article . com,

mr_espresso wrote:
Since the search function only allows one search term at a time, how
can one search a cell for several keywords?


For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.


My apologies if this question already has been addressed, but I didn't
see anything in the archives.


Thank you in advance!



  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to search a cell for multiple keywords?

Actually, you could use search for multiple terms. Assuming your data is in
A1:A9

=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1:A9))) )0)

But, it has to use an extra nested function call (Isnumber), so it's not as
efficient as JE's.


"mr_espresso" wrote:

Since the search function only allows one search term at a time, how
can one search a cell for several keywords?

For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.

My apologies if this question already has been addressed, but I didn't
see anything in the archives.

Thank you in advance!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to search a cell for multiple keywords?

Thanks, JMB.

Your formula may be less efficient, but it actually worked better. The
other formula mistakenly assigned 0's to cells which should have been
1's.

On Apr 28, 10:56 am, JMB wrote:
Actually, you could use search for multiple terms. Assuming your data is in
A1:A9

=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1:A9))) )0)

But, it has to use an extra nested function call (Isnumber), so it's not as
efficient as JE's.

"mr_espresso" wrote:
Since the search function only allows one search term at a time, how
can one search a cell for several keywords?


For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.


My apologies if this question already has been addressed, but I didn't
see anything in the archives.


Thank you in advance!





  #6   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to search a cell for multiple keywords?

Maybe the difference is JE has a wildcard at the beginning of the criteria???

*doc*
*nur*
*paramed*

Also, both JE's and mine evaluate a range of cells, so if any of those
criteria are present in any cell in that range - it will return a 1. If you
want a separate indicator for each cell in the range being searched, adjust
the range reference.

Using my example:

=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1))))0 )

entered in B1 then drag down to B9.


"mr_espresso" wrote:

Thanks, JMB.

Your formula may be less efficient, but it actually worked better. The
other formula mistakenly assigned 0's to cells which should have been
1's.

On Apr 28, 10:56 am, JMB wrote:
Actually, you could use search for multiple terms. Assuming your data is in
A1:A9

=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1:A9))) )0)

But, it has to use an extra nested function call (Isnumber), so it's not as
efficient as JE's.

"mr_espresso" wrote:
Since the search function only allows one search term at a time, how
can one search a cell for several keywords?


For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.


My apologies if this question already has been addressed, but I didn't
see anything in the archives.


Thank you in advance!




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to search a cell for multiple keywords?

I'm using a wildcard before and after in your formula too, so the only
difference is the formula itself.

The only downside of your formula is that it's VERY slow to calculate
(and I have a fast computer). There is one target cell being analyzed
and it's about 100 words long, but I'm working with 1000 cases / rows,
so there are approximately 100,000 words to analyze each time I hit
<calculate.

Plus, I'm searching for about 10 different groups of keywords (e.g. 1:
doctor / nurse / paramedic , 2: university / college, 3: goal /
aspiration / dream ...)

Any tips on speeding up the calculations? Every time I change a
formula and want to recalculate, Excel takes forever. I tried
selecting just the column I want to recalculate but Excel keeps going
to the next column, etc.

Thanks again!

On Apr 30, 7:19 pm, JMB wrote:
Maybe the difference is JE has a wildcard at the beginning of the criteria???

*doc*
*nur*
*paramed*

Also, both JE's and mine evaluate a range of cells, so if any of those
criteria are present in any cell in that range - it will return a 1. If you
want a separate indicator for each cell in the range being searched, adjust
the range reference.

Using my example:

=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1))))0 )

entered in B1 then drag down to B9.

"mr_espresso" wrote:
Thanks, JMB.


Your formula may be less efficient, but it actually worked better. The
other formula mistakenly assigned 0's to cells which should have been
1's.


On Apr 28, 10:56 am, JMB wrote:
Actually, you could use search for multiple terms. Assuming your data is in
A1:A9


=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1:A9))) )0)


But, it has to use an extra nested function call (Isnumber), so it's not as
efficient as JE's.


"mr_espresso" wrote:
Since the search function only allows one search term at a time, how
can one search a cell for several keywords?


For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.


My apologies if this question already has been addressed, but I didn't
see anything in the archives.


Thank you in advance!



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to search a cell for multiple keywords?

To answer my own question: putting each search in a different
worksheet speeds things up considerably. It still takes about 1 minute
to recalculate but this is way faster than before.

On May 1, 9:20 am, mr_espresso wrote:
I'm using a wildcard before and after in your formula too, so the only
difference is the formula itself.

The only downside of your formula is that it's VERY slow to calculate
(and I have a fast computer). There is one target cell being analyzed
and it's about 100 words long, but I'm working with 1000 cases / rows,
so there are approximately 100,000 words to analyze each time I hit
<calculate.

Plus, I'm searching for about 10 different groups of keywords (e.g. 1:
doctor / nurse / paramedic , 2: university / college, 3: goal /
aspiration / dream ...)

Any tips on speeding up the calculations? Every time I change a
formula and want to recalculate, Excel takes forever. I tried
selecting just the column I want to recalculate but Excel keeps going
to the next column, etc.

Thanks again!

On Apr 30, 7:19 pm, JMB wrote:

Maybe the difference is JE has a wildcard at the beginning of the criteria???


*doc*
*nur*
*paramed*


Also, both JE's and mine evaluate a range of cells, so if any of those
criteria are present in any cell in that range - it will return a 1. If you
want a separate indicator for each cell in the range being searched, adjust
the range reference.


Using my example:


=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1))))0 )


entered in B1 then drag down to B9.


"mr_espresso" wrote:
Thanks, JMB.


Your formula may be less efficient, but it actually worked better. The
other formula mistakenly assigned 0's to cells which should have been
1's.


On Apr 28, 10:56 am, JMB wrote:
Actually, you could use search for multiple terms. Assuming your data is in
A1:A9


=--(SUMPRODUCT(--(ISNUMBER(SEARCH({"doc*","nur*","param*"},A1:A9))) )0)


But, it has to use an extra nested function call (Isnumber), so it's not as
efficient as JE's.


"mr_espresso" wrote:
Since the search function only allows one search term at a time, how
can one search a cell for several keywords?


For example, I want to search a survey comments field for terms like
<doctor, nurse, paramedic and I need to use wildcards like <doct*.
Ideally the function would return a 1 if one or more of the keywords
is present, and a 0 if none are found.


My apologies if this question already has been addressed, but I didn't
see anything in the archives.


Thank you in advance!



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 formula referencing range of keywords Malvaro Excel Worksheet Functions 5 July 7th 08 03:47 PM
How do I search for keywords in cells containing text? Fredrik Excel Worksheet Functions 4 June 28th 07 01:56 PM
Need Help!! Want to search through 3 columns for a list of keywords The Moose Excel Worksheet Functions 7 January 2nd 07 03:12 AM
Keyword search, several keywords Doman Excel Discussion (Misc queries) 1 July 24th 06 10:58 AM
Search Excel files for text and keywords? quartz[_2_] Excel Programming 4 December 5th 05 08:16 AM


All times are GMT +1. The time now is 02:09 PM.

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"