#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default Search range

Hi, I need to search a range of cells for a piece of text, not an exact match
of the whole string, but just some words. Then, when it finds that I need to
pull the information same row, 1 column to the left. I have descriptions in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Search range

...........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an exact
match
of the whole string, but just some words. Then, when it finds that I need
to
pull the information same row, 1 column to the left. I have descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Search range

Yes, I know I could've used SUMIF but I'm working on the assumption the
value to be returned could be either numeric or text.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
..........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an exact
match
of the whole string, but just some words. Then, when it finds that I need
to
pull the information same row, 1 column to the left. I have descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default Search range

That worked, thank you. Can you explain to me how the section "*"&D1&"*"
works? What are the "*" and the & for?

Thanks,
John

"T. Valko" wrote:

...........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an exact
match
of the whole string, but just some words. Then, when it finds that I need
to
pull the information same row, 1 column to the left. I have descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default Search range

1 more quick one. Is there a way to tell it that once it found the text, look
for the next instance? There could be more than 1 match and I need each of
the corresponding numbers placed in a column.

Thanks,
John

"T. Valko" wrote:

Yes, I know I could've used SUMIF but I'm working on the assumption the
value to be returned could be either numeric or text.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
..........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an exact
match
of the whole string, but just some words. Then, when it finds that I need
to
pull the information same row, 1 column to the left. I have descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John








  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Search range

What are the "*" and the & for?

The "*" are wildcards and the "&" is the concatenation operator. When you
see the "&" think of it as the word AND.

This is what it means:

"any character or characters" & this is it & "any character or characters"

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
That worked, thank you. Can you explain to me how the section "*"&D1&"*"
works? What are the "*" and the & for?

Thanks,
John

"T. Valko" wrote:

...........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an exact
match
of the whole string, but just some words. Then, when it finds that I
need
to
pull the information same row, 1 column to the left. I have
descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John






  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Search range

If there's more than 1 instance then it gets complicated. I'm getting ready
to break for dinner so I'll be away for a few hours but I'll post a solution
when I return (unless someone else chimes in while I'm gone).

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
1 more quick one. Is there a way to tell it that once it found the text,
look
for the next instance? There could be more than 1 match and I need each of
the corresponding numbers placed in a column.

Thanks,
John

"T. Valko" wrote:

Yes, I know I could've used SUMIF but I'm working on the assumption the
value to be returned could be either numeric or text.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
..........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an
exact
match
of the whole string, but just some words. Then, when it finds that I
need
to
pull the information same row, 1 column to the left. I have
descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John







  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default Search range

Thanks, I really appreciate it.

Have a good dinner!!

Thanks,
John

"T. Valko" wrote:

If there's more than 1 instance then it gets complicated. I'm getting ready
to break for dinner so I'll be away for a few hours but I'll post a solution
when I return (unless someone else chimes in while I'm gone).

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
1 more quick one. Is there a way to tell it that once it found the text,
look
for the next instance? There could be more than 1 match and I need each of
the corresponding numbers placed in a column.

Thanks,
John

"T. Valko" wrote:

Yes, I know I could've used SUMIF but I'm working on the assumption the
value to be returned could be either numeric or text.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
..........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an
exact
match
of the whole string, but just some words. Then, when it finds that I
need
to
pull the information same row, 1 column to the left. I have
descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of the
description I need the code.

Any help would be great.

Thanks,
John








  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Search range

Ok, based the table below:

...........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........this is it

Lookup "this is it"

D1 = this is it

Enter this array formula** in E1 and copy down until you get blanks:

=IF(ROWS(E$1:E1)<=COUNTIF(B$1:B$5,"*"&D$1&"*"),IND EX(A$1:A$5,SMALL(IF(ISNUMBER(SEARCH(D$1,B$1:B$5)), ROW(A$1:A$5)),ROWS(E$1:E1))-ROW(A$1)+1),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Results:
E1 = 1
E2 = 9
E3 = (blank)


--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Thanks, I really appreciate it.

Have a good dinner!!

Thanks,
John

"T. Valko" wrote:

If there's more than 1 instance then it gets complicated. I'm getting
ready
to break for dinner so I'll be away for a few hours but I'll post a
solution
when I return (unless someone else chimes in while I'm gone).

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
1 more quick one. Is there a way to tell it that once it found the text,
look
for the next instance? There could be more than 1 match and I need each
of
the corresponding numbers placed in a column.

Thanks,
John

"T. Valko" wrote:

Yes, I know I could've used SUMIF but I'm working on the assumption
the
value to be returned could be either numeric or text.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
..........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an
exact
match
of the whole string, but just some words. Then, when it finds that
I
need
to
pull the information same row, 1 column to the left. I have
descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of
the
description I need the code.

Any help would be great.

Thanks,
John










  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default Search range

OK, so I got it to work with your data, but when I tried to adapt it to mine
I got an error, #Value!. I am using named ranges on a different worksheet,
same workbook, for my equivalent of your A1:A5 and B1:B5, would that make a
difference?

Thanks for all your help. I'm sorry this is becoming more complicated than
you probably wanted to deal with.

Thanks,
John

"T. Valko" wrote:

Ok, based the table below:

...........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........this is it

Lookup "this is it"

D1 = this is it

Enter this array formula** in E1 and copy down until you get blanks:

=IF(ROWS(E$1:E1)<=COUNTIF(B$1:B$5,"*"&D$1&"*"),IND EX(A$1:A$5,SMALL(IF(ISNUMBER(SEARCH(D$1,B$1:B$5)), ROW(A$1:A$5)),ROWS(E$1:E1))-ROW(A$1)+1),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Results:
E1 = 1
E2 = 9
E3 = (blank)


--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Thanks, I really appreciate it.

Have a good dinner!!

Thanks,
John

"T. Valko" wrote:

If there's more than 1 instance then it gets complicated. I'm getting
ready
to break for dinner so I'll be away for a few hours but I'll post a
solution
when I return (unless someone else chimes in while I'm gone).

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
1 more quick one. Is there a way to tell it that once it found the text,
look
for the next instance? There could be more than 1 match and I need each
of
the corresponding numbers placed in a column.

Thanks,
John

"T. Valko" wrote:

Yes, I know I could've used SUMIF but I'm working on the assumption
the
value to be returned could be either numeric or text.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
..........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Hi, I need to search a range of cells for a piece of text, not an
exact
match
of the whole string, but just some words. Then, when it finds that
I
need
to
pull the information same row, 1 column to the left. I have
descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece of
the
description I need the code.

Any help would be great.

Thanks,
John













  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Search range

Named ranges don't make any difference *except* that they need to be the
*exact same size*.


--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
OK, so I got it to work with your data, but when I tried to adapt it to
mine
I got an error, #Value!. I am using named ranges on a different worksheet,
same workbook, for my equivalent of your A1:A5 and B1:B5, would that make
a
difference?

Thanks for all your help. I'm sorry this is becoming more complicated than
you probably wanted to deal with.

Thanks,
John

"T. Valko" wrote:

Ok, based the table below:

...........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........this is it

Lookup "this is it"

D1 = this is it

Enter this array formula** in E1 and copy down until you get blanks:

=IF(ROWS(E$1:E1)<=COUNTIF(B$1:B$5,"*"&D$1&"*"),IND EX(A$1:A$5,SMALL(IF(ISNUMBER(SEARCH(D$1,B$1:B$5)), ROW(A$1:A$5)),ROWS(E$1:E1))-ROW(A$1)+1),"")

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Results:
E1 = 1
E2 = 9
E3 = (blank)


--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
Thanks, I really appreciate it.

Have a good dinner!!

Thanks,
John

"T. Valko" wrote:

If there's more than 1 instance then it gets complicated. I'm getting
ready
to break for dinner so I'll be away for a few hours but I'll post a
solution
when I return (unless someone else chimes in while I'm gone).

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in message
...
1 more quick one. Is there a way to tell it that once it found the
text,
look
for the next instance? There could be more than 1 match and I need
each
of
the corresponding numbers placed in a column.

Thanks,
John

"T. Valko" wrote:

Yes, I know I could've used SUMIF but I'm working on the assumption
the
value to be returned could be either numeric or text.

--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
..........A..........B
1........5........not his stuff
2........2........some more junk
3........1........yes, this is it
4........6........blah blah blah
5........9........I need a break

Lookup "this is it"

D1 = this is it

=INDEX(A1:A5,MATCH("*"&D1&"*",B1:B,0))

Result = 1

--
Biff
Microsoft Excel MVP


"johnrb7865" wrote in
message
...
Hi, I need to search a range of cells for a piece of text, not
an
exact
match
of the whole string, but just some words. Then, when it finds
that
I
need
to
pull the information same row, 1 column to the left. I have
descriptions
in
the 2nd column and codes in the 1st, and when it finds a piece
of
the
description I need the code.

Any help would be great.

Thanks,
John













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
How to keep a set range in a Search function Connie Excel Worksheet Functions 1 August 6th 08 08:24 PM
Search for value in a range Student Excel Worksheet Functions 6 January 31st 08 12:46 AM
search within a range of cells? [email protected] Excel Discussion (Misc queries) 2 April 22nd 07 08:08 AM
Search range for text not in another range simon howard Excel Discussion (Misc queries) 3 March 28th 07 08:44 PM
how do you search a range of cells... Xanadude Excel Discussion (Misc queries) 2 June 6th 05 05:30 AM


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