ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Searching Text that contains particular WORDS. (https://www.excelbanter.com/excel-worksheet-functions/155807-searching-text-contains-particular-words.html)

Abdullah Kajee

Searching Text that contains particular WORDS.
 
Text in cell A1 " the quick brown fox"
Text in cel A2 " June is here"
Text in cell A3 " Today is Monday" and so on until row A55000.
I have a spreadsheet with thousands of lines but some lines of text repeats
as above. How do I write one IF statement that searches for one of three
words such as "brown", "here" and "Monday" and then returns the keyword that
I am looking for. This way, I can quickly filter on all lines that have the
word Monday or the word June etc..I know I can use
=IF(ISNUMBER(SEARCH(.......but help me to understand how to write 3 criteria
or more in one statement...right now I can only write one criteria ie
=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE"

Ron Rosenfeld

Searching Text that contains particular WORDS.
 
On Sat, 25 Aug 2007 06:26:01 -0700, Abdullah Kajee
wrote:

Text in cell A1 " the quick brown fox"
Text in cel A2 " June is here"
Text in cell A3 " Today is Monday" and so on until row A55000.
I have a spreadsheet with thousands of lines but some lines of text repeats
as above. How do I write one IF statement that searches for one of three
words such as "brown", "here" and "Monday" and then returns the keyword that
I am looking for. This way, I can quickly filter on all lines that have the
word Monday or the word June etc..I know I can use
=IF(ISNUMBER(SEARCH(.......but help me to understand how to write 3 criteria
or more in one statement...right now I can only write one criteria ie
=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE"



You can nest up to seven IF's:

=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE",
IF(ISNUMBER(SEARCH("Brown",A2)),"Brown","not found"))

You can also use an array argument for the search term in your search
statement:

=CHOOSE(MATCH(TRUE,ISNUMBER(SEARCH({"Brown";"here" ;"Monday"},L1:L55000)),0),"Brown","Here","Monda y")

ARRAY-Entered with <ctrl<shift<enter will return the key word for the first
match.


But what if multiple key words are present? If in your 55000 lines, you might
have BROWN and HERE present.

You might want to investigate the Advanced Filter under the Data Menu.
--ron

Abdullah Kajee

Searching Text that contains particular WORDS.
 
Thank you so much Ron...I will try the nesting bit...the CHOOSE function
worked beautifully...the only problem is that I am getting a lot of #NA
results where there is no match...how do I write into the formula to leave
blank if no match?

"Ron Rosenfeld" wrote:

On Sat, 25 Aug 2007 06:26:01 -0700, Abdullah Kajee
wrote:

Text in cell A1 " the quick brown fox"
Text in cel A2 " June is here"
Text in cell A3 " Today is Monday" and so on until row A55000.
I have a spreadsheet with thousands of lines but some lines of text repeats
as above. How do I write one IF statement that searches for one of three
words such as "brown", "here" and "Monday" and then returns the keyword that
I am looking for. This way, I can quickly filter on all lines that have the
word Monday or the word June etc..I know I can use
=IF(ISNUMBER(SEARCH(.......but help me to understand how to write 3 criteria
or more in one statement...right now I can only write one criteria ie
=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE"



You can nest up to seven IF's:

=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE",
IF(ISNUMBER(SEARCH("Brown",A2)),"Brown","not found"))

You can also use an array argument for the search term in your search
statement:

=CHOOSE(MATCH(TRUE,ISNUMBER(SEARCH({"Brown";"here" ;"Monday"},L1:L55000)),0),"Brown","Here","Monda y")

ARRAY-Entered with <ctrl<shift<enter will return the key word for the first
match.


But what if multiple key words are present? If in your 55000 lines, you might
have BROWN and HERE present.

You might want to investigate the Advanced Filter under the Data Menu.
--ron


Abdullah Kajee

Searching Text that contains particular WORDS.
 
RON,
Just to THANK YOU again and to let you know that I used the nesting of the
IF(ISNUMBER formula with a criteria to leave "" (blank) if no matches and it
works. Thank you very much...it is wonderful to have such a global community
for knowledge and information sharing. This is truly a connected community.

"Ron Rosenfeld" wrote:

On Sat, 25 Aug 2007 06:26:01 -0700, Abdullah Kajee
wrote:

Text in cell A1 " the quick brown fox"
Text in cel A2 " June is here"
Text in cell A3 " Today is Monday" and so on until row A55000.
I have a spreadsheet with thousands of lines but some lines of text repeats
as above. How do I write one IF statement that searches for one of three
words such as "brown", "here" and "Monday" and then returns the keyword that
I am looking for. This way, I can quickly filter on all lines that have the
word Monday or the word June etc..I know I can use
=IF(ISNUMBER(SEARCH(.......but help me to understand how to write 3 criteria
or more in one statement...right now I can only write one criteria ie
=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE"



You can nest up to seven IF's:

=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE",
IF(ISNUMBER(SEARCH("Brown",A2)),"Brown","not found"))

You can also use an array argument for the search term in your search
statement:

=CHOOSE(MATCH(TRUE,ISNUMBER(SEARCH({"Brown";"here" ;"Monday"},L1:L55000)),0),"Brown","Here","Monda y")

ARRAY-Entered with <ctrl<shift<enter will return the key word for the first
match.


But what if multiple key words are present? If in your 55000 lines, you might
have BROWN and HERE present.

You might want to investigate the Advanced Filter under the Data Menu.
--ron


Ron Rosenfeld

Searching Text that contains particular WORDS.
 
On Sat, 25 Aug 2007 07:12:02 -0700, Abdullah Kajee
wrote:

Thank you so much Ron...I will try the nesting bit...the CHOOSE function
worked beautifully...the only problem is that I am getting a lot of #NA
results where there is no match...how do I write into the formula to leave
blank if no match?


There are many ways. One method:

=IF(ISNA(your_formula),"",your_formula)

and I think you're better off with the nesting approach. I've run into some
glitches using the SEARCH array approach and I don't have time to figure it out
right now.


--ron

Ron Rosenfeld

Searching Text that contains particular WORDS.
 
On Sat, 25 Aug 2007 07:24:01 -0700, Abdullah Kajee
wrote:

RON,
Just to THANK YOU again and to let you know that I used the nesting of the
IF(ISNUMBER formula with a criteria to leave "" (blank) if no matches and it
works. Thank you very much...it is wonderful to have such a global community
for knowledge and information sharing. This is truly a connected community.


You're very welcome. Thanks for the feedback.
--ron

Tevuna

Searching Text that contains particular WORDS.
 
Perhaps an auto filter would make a staight approach
Contains "June" OR Contains "Brown"

"Abdullah Kajee" wrote:

Text in cell A1 " the quick brown fox"
Text in cel A2 " June is here"
Text in cell A3 " Today is Monday" and so on until row A55000.
I have a spreadsheet with thousands of lines but some lines of text repeats
as above. How do I write one IF statement that searches for one of three
words such as "brown", "here" and "Monday" and then returns the keyword that
I am looking for. This way, I can quickly filter on all lines that have the
word Monday or the word June etc..I know I can use
=IF(ISNUMBER(SEARCH(.......but help me to understand how to write 3 criteria
or more in one statement...right now I can only write one criteria ie
=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE"


Abdullah Kajee

Searching Text that contains particular WORDS.
 
Thanks for responding Tevuna...your approach works as well...I just needed a
statement that I could use for managing more than 1000 line situations given
that EXCEL filters fail on the 1000th line.


"Tevuna" wrote:

Perhaps an auto filter would make a staight approach
Contains "June" OR Contains "Brown"

"Abdullah Kajee" wrote:

Text in cell A1 " the quick brown fox"
Text in cel A2 " June is here"
Text in cell A3 " Today is Monday" and so on until row A55000.
I have a spreadsheet with thousands of lines but some lines of text repeats
as above. How do I write one IF statement that searches for one of three
words such as "brown", "here" and "Monday" and then returns the keyword that
I am looking for. This way, I can quickly filter on all lines that have the
word Monday or the word June etc..I know I can use
=IF(ISNUMBER(SEARCH(.......but help me to understand how to write 3 criteria
or more in one statement...right now I can only write one criteria ie
=IF(ISNUMBER(SEARCH("JUNE",A2)),"JUNE"


Gord Dibben

Searching Text that contains particular WORDS.
 
Not true that filters fail on the 1000th row.

The autofilter drowdown list shows only 1000 items, but you can work around that
by using customcontains or see Debra Dalgleish's site for further refinement.

http://www.contextures.on.ca/xlautofilter02.html#Limits


Gord Dibben MS Excel MVP


On Sun, 26 Aug 2007 02:46:10 -0700, Abdullah Kajee
wrote:

Thanks for responding Tevuna...your approach works as well...I just needed a
statement that I could use for managing more than 1000 line situations given
that EXCEL filters fail on the 1000th line.



Abdullah Kajee

Searching Text that contains particular WORDS.
 
Thanks Gord...I will give it a try...but for my purposes, Ron Rosenfeld gave
me 2 solutions which suffice for my applicqtion...I need a formula rather
than a filter as I will be using the formula in SAP BW to return a specific
report...many thanks for repsonding...all inputs are value add...you learn
something new with each input.

"Gord Dibben" wrote:

Not true that filters fail on the 1000th row.

The autofilter drowdown list shows only 1000 items, but you can work around that
by using customcontains or see Debra Dalgleish's site for further refinement.

http://www.contextures.on.ca/xlautofilter02.html#Limits


Gord Dibben MS Excel MVP


On Sun, 26 Aug 2007 02:46:10 -0700, Abdullah Kajee
wrote:

Thanks for responding Tevuna...your approach works as well...I just needed a
statement that I could use for managing more than 1000 line situations given
that EXCEL filters fail on the 1000th line.





All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com