Formula to match/lookup if part of a string in a cell is equal to a value in a given range and return this value

我是研究僧i 提交于 2019-12-24 01:54:36

问题


I have two text ranges in two columns in excel like that:

____________________________________________________________
  |             A                |     B      |      C     |
------------------------------------------------------------
1 | Mazda Mazda6 i               | Escape     |            |
2 | Ford F150 XL                 | Pathfinder |            |
3 | Ford Freestar SEL            | Jetta      |            |
4 | Ford Explorer Eddie Bauer    | Yaris      |            |
5 | Ford Escape XLT              | Mazda6     |            |
6 | Nissan Pathfinder LE         | F150       |            |
7 | Volkswagen Jetta 2.5         | Tahoe      |            |
8 | Toyota Yaris Base            | Freestar   |            |
9 | Chevrolet Tahoe LS           | Explorer   |            |
------------------------------------------------------------

What I need to do is a formula in C1 to check if any word from range B1:B9 is contained in Cell A1 and if yes, in cell C1 to return the value of the respective matching cell from B1:B9. Then move to C2, check if any word from range B1:B9 is contained in cell A2, and return the matching value from range B1:B9. IF not contained, it can be either #N/A or blank it does not matter.

As example, the formula in C1 should check if any word from B1:B9 matches a string in A1. In this case the returned value in C1 should be Mazda6.

Is there an easy way to do this? I have been trying to find a formula that work on the web for 2 days now and still no luck.

If anyone can help it will be much appreciated.


回答1:


Revised answer due to misunderstanding of question - try this formula in C1 copied down

=IFERROR(LOOKUP(2^15,SEARCH(" "&B$1:B$9&" "," "&A1&" "),B$1:B$9),"")

Assumes only one match at most - B1:B9 should all be populated

This will find matches without getting any "partial matches" like matching red with incredible



来源:https://stackoverflow.com/questions/25289460/formula-to-match-lookup-if-part-of-a-string-in-a-cell-is-equal-to-a-value-in-a-g

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!