简体   繁体   English

Excel 公式返回值而不是 TRUE 或 False

[英]Excel formula to return value instead of TRUE or False

I am very newbie in excel, I wanted to make my formula to return matched value instead of TRUE/FALSE我是 excel 的新手,我想让我的公式返回匹配值而不是 TRUE/FALSE

=NOT(NOT(SUM(--NOT(ISERR(SEARCH($D$2:$D$21;$B2))))))

is there anyway this formula can be revised to return like for example: found word "wow" and return the word into the cell instead of TRUE/FALSE?无论如何,这个公式可以修改为返回,例如:找到单词“wow”并将单词返回到单元格而不是 TRUE/FALSE?

thank you谢谢你

您可以使用 IF 函数:

=IF(logical_test, CONCAT("Found word", $YourWord), "Not found")

Use the =IF function.使用=IF函数。

=IF(condition; value if true; value if false)

  • condition is your condition to test. condition是你要测试的条件。 For example $A$1 < 5例如$A$1 < 5
  • value if true is a value returned if condition is true value if true是条件为 true 时返回的值
  • value if false opposite to previous part, this is a value returned if condition is false. value if false与前一部分相反,这是如果条件为 false 时返回的值。

Following formula will return a $A$1 cell value if less than 5 and too big literally if $A$1 's value is bigger or equal to 5:如果小于 5,则以下公式将返回$A$1单元格值,如果$A$1的值大于或等于 5,则字面意义上的too big

=IF($A$1<5; $A$1; "too big")

Just combine it with your condition.只需将其与您的情况结合起来即可。

This will help You Remember the " Text " must be in " "这将帮助您记住“ Text ”必须在" "

=IF(ISNUMBER(SEARCH(substring;"WOW")); "Yes"; "No")

The Value will be only Yes or No , You may change that该值将只有 Yes 或 No ,您可以更改它

There are two cases and I'm not sure which one you need有两种情况,我不确定您需要哪一种

(1) You have a word like WOW, and you want to find matches in a list of strings like BOWWOW (1) 你有一个像 WOW 这样的词,并且你想在像 BOWWOW 这样的字符串列表中查找匹配项

(2) You have a word like WOW, and you want to find matches for part of it in a list of substrings like OW (2) 你有一个像 WOW 这样的词,并且你想在像 OW 这样的子字符串列表中找到它的一部分的匹配项

The easiest way to do the first one is to use MATCH with a wildcard第一个最简单的方法是使用 MATCH 和通配符

=INDEX($D$2:$D$21,MATCH("*"&B2&"*",$D$2:$D$21,0))

For the second one you would need to modify your formula a bit对于第二个,您需要稍微修改一下公式

=INDEX($D$2:$D$21,MATCH(0,(ISERROR(SEARCH($D$2:$D$21,$B$2))+($D$2:$D$21="")),0))

or或者

=INDEX($D$2:$D$21,MATCH(1,ISNUMBER(SEARCH($D$2:$D$21,$B$2))*($D$2:$D$21<>""),0))

the last two entered as array formulae using Ctrl Shift Enter最后两个使用Ctrl Shift Enter作为数组公式输入

在此处输入图像描述

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM