简体   繁体   English

Excel - 如果单元格包含列表中的文本,则返回另一个单元格的值

[英]Excel - if cell contains text in a list then return value of another cell

I have 3 columns:我有 3 列:

A - Lookup item A - 查找项
B - List B - 清单
C - Link C-链接
D - formula goes here D - 公式在这里

I want to search column B for the text in each cell in column A.我想在 B 列中搜索 A 列中每个单元格中的文本。

For example, A2="bread" and with column B it has B2="some bread" and would return TRUE.例如,A2="bread" 并且对于 B 列,它具有 B2="some bread" 并且将返回 TRUE。 If it's TRUE, then I want to return the value in C2="abc".如果它是 TRUE,那么我想返回 C2="abc" 中的值。

Another example, A3="eggs" and B3="egg" would return FALSE.另一个示例,A3="eggs" 和 B3="egg" 将返回 FALSE。 But B4="eggs" and would return TRUE, then I want to return value in D3="ghi".但是 B4="eggs" 并且会返回 TRUE,那么我想在 D3="ghi" 中返回值。

Here's an image to illustrate:这是一张图片来说明:

在此处输入图像描述

I can find the word in column A to any in the list in column be with this formula:我可以使用以下公式在列的列表中找到 A 列中的任何单词:

=if(countif($B$2:$B$6,"*"&A2&"*")>0,true,false)

But I can't get the right mix of INDEX and MATCH to return the contents in column C when needed.但是我无法正确组合 INDEX 和 MATCH 以在需要时返回 C 列中的内容。 I think I need a mix of INDEX with ROW instead of MATCH.我想我需要混合使用 INDEX 和 ROW 而不是 MATCH。

The issue with MATCH is the 3rd argument is [match_type] which is "1= exact or next smallest(default)", "0=exact match", "-1 = exact or next largest". MATCH 的问题是第三个参数是 [match_type],它是“1= 精确或次小(默认)”、“0=精确匹配”、“-1 = 精确或次大”。

Version: Excel 2016 (also would like it to work in Google Sheets but not required)版本:Excel 2016(也希望它可以在 Google 表格中使用,但不是必需的)

Try Match() function with wildcard matching.尝试使用通配符匹配的Match()函数。

=IFERROR(INDEX($C$2:$C$6,MATCH("*"&A2&"*",$B$2:$B$6,0)),FALSE)

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Excel:如果单元格包含特定文本,则返回值 - Excel: Return value if cell contains a certain text 如果另一个单元格包含 Excel 中的特定文本,则在一个单元格中生成一个值 - Produce a value in one cell, if another cell contains a specific text in Excel Excel-如果单元格包含一个值,则返回另一个值(如果未搜索其他值) - Excel - IF a cell contains a value return another value, if not search for a different value Excel 检查单元格是否包含列表中的文本并从列表中返回值 - Excel check if cell contains text from list and return value from list 如何将单元格文本与包含Excel中已有文本的另一个单元格合并? - How to join a cell text with another cell that contains text already in excel? Excel:如何在包含字符串的列中查找单元格并在另一列行中返回单元格的值? - Excel: How to find cell in a column that contains a string and return value of a cell in another column of row? 如果在列表数组中找到匹配项,则Excel返回另一个单元格值 - Excel Return another cell value if a match is found in an array of list Excel - 单元格包含列表中的值 - 返回列表值但避免返回不正确的值 - Excel - Cell Contains a Value from a List - Return list value but avoid returning incorrect value Excel:如果单元格包含特定值,则将某些文本放入新单元格中 - Excel : If cell contains certain value then put certain text in new cell Excel 检查单元格是否包含列表中的文本并为每个匹配项返回列表中的值 - Excel check if cell contains text from list and return values from list for every match
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM