使用Excel

时间:2017-07-06 12:07:37

标签: excel excel-formula excel-2010

我有一个可以粘贴链接的单元格。例如: https://stackoverflow.com/questions/ask

我希望旁边的单元格说"错误"如果文字包含" / "或" "或" = "。它应该说"正确"在文本中找不到这3个字符。

For example:
test/
Would give "Wrong" because it contains at least 1 "/"

/test:
Would give "Wrong" because it contains at least 1 ":" and at least 1 "/"

test///////
Would give "Wrong" because it contains at least 1 "/"

test/:=
Would give "Wrong" because it contains at least 1 "/", at least 1 ":" and at least 1 "/"

test123{}+_)
Would give "Correct" because it does not contain any "/", ":" or "="

我尝试使用嵌套的IF,但我无法让它工作。在公式中添加第三个字符时,我一直遇到错误。

1 个答案:

答案 0 :(得分:3)

试试这个

=IF(OR(ISNUMBER(SEARCH("/",A1)),ISNUMBER(SEARCH(":",A1)),ISNUMBER(SEARCH("=",A1))),"Wrong","Correct")

或者优选这个

=IF(OR(ISNUMBER(SEARCH({"/",":","="},A1))),"Wrong","Correct")

参见图片以供参考。

enter image description here