ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Match word in one column to another (https://www.excelbanter.com/excel-discussion-misc-queries/212111-match-word-one-column-another.html)

David P.

Match word in one column to another
 
I need a formula to output in column C the closest match in column B from
column A:

Column A Coumn B Column C
"I ate apples" "Orange" Formula to output "Apple" as a
closest match
"I ate oranges" "Pear"
"I ate pears" "Apple"

I know this is probably elementary but thank you for the help.
--
David P.

Max

Match word in one column to another
 
One way
In C1, normal ENTER:
=INDEX(B$1:B$3,MATCH(TRUE,INDEX(ISNUMBER(SEARCH($B $1:$B$3,A1)),),0))
Copy down. Adapt the range: B$1:B$3 to suit
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
"David P." wrote:
I need a formula to output in column C the closest match in column B from
column A:

Column A Coumn B Column C
"I ate apples" "Orange" Formula to output "Apple" as a
closest match
"I ate oranges" "Pear"
"I ate pears" "Apple"

I know this is probably elementary but thank you for the help.



David P.

Match word in one column to another
 
Thank you Max. How would it change the formula if I had mulitple words in
column B like this:

Column A Coumn B Column C
"I ate apples" "Delicious Orange" Output "Delicious Apple" as
closest match
"I ate oranges" "Delicious Pear"
"I ate pears" "Delicious Apple"

I ask this because when I changed column B to more than one word it gave me
an #N/A. I will have multiple words in Column B in many cases. Many thanks.
--
David P.


"Max" wrote:

One way
In C1, normal ENTER:
=INDEX(B$1:B$3,MATCH(TRUE,INDEX(ISNUMBER(SEARCH($B $1:$B$3,A1)),),0))
Copy down. Adapt the range: B$1:B$3 to suit
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
"David P." wrote:
I need a formula to output in column C the closest match in column B from
column A:

Column A Coumn B Column C
"I ate apples" "Orange" Formula to output "Apple" as a
closest match
"I ate oranges" "Pear"
"I ate pears" "Apple"

I know this is probably elementary but thank you for the help.



Max

Match word in one column to another
 
Yes, it doesn't work with multiple words. I mean, for example, how would you
possibly expect Excel to know which word in the phrase to focus on,
"Delicious" or "Orange"? Excel will just take the entire phrase to search,
unemotively.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
"David P." wrote in message
...
Thank you Max. How would it change the formula if I had mulitple words in
column B like this:

Column A Coumn B Column C
"I ate apples" "Delicious Orange" Output "Delicious Apple" as
closest match
"I ate oranges" "Delicious Pear"
"I ate pears" "Delicious Apple"

I ask this because when I changed column B to more than one word it gave
me
an #N/A. I will have multiple words in Column B in many cases. Many
thanks.
--
David P.




David P.

Match word in one column to another
 
Could it search for "Delicious Orange" as an entire phrase?
--
David P.


"Max" wrote:

Yes, it doesn't work with multiple words. I mean, for example, how would you
possibly expect Excel to know which word in the phrase to focus on,
"Delicious" or "Orange"? Excel will just take the entire phrase to search,
unemotively.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---
"David P." wrote in message
...
Thank you Max. How would it change the formula if I had mulitple words in
column B like this:

Column A Coumn B Column C
"I ate apples" "Delicious Orange" Output "Delicious Apple" as
closest match
"I ate oranges" "Delicious Pear"
"I ate pears" "Delicious Apple"

I ask this because when I changed column B to more than one word it gave
me
an #N/A. I will have multiple words in Column B in many cases. Many
thanks.
--
David P.





Max

Match word in one column to another
 
Could it search for "Delicious Orange" as an entire phrase?

Yes of course. If it is as an entire phrase, then my original response
should have worked. You might want to fortify it a bit more by using TRIM
around A1, since the search string (the entire phrase) now contains a single
space:
=INDEX(B$1:B$3,MATCH(TRUE,INDEX(ISNUMBER(SEARCH($B $1:$B$3,TRIM(A1))),),0))

If this response helped in any way, do press the YES button below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:365 Subscribers:65
xdemechanik
---


All times are GMT +1. The time now is 10:13 PM.

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