使用Excel在单元格中查找某些字符

时间:2021-09-27 22:15:57

I have a cell where a link can be pasted. For example: https://*.com/questions/ask

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

I want the cell next to it say "wrong" IF the text contains "/" or ":" or "=". It should say "Correct" is none of these 3 characters are found in the text.

如果文本包含“/”或“:”或“=”,我希望它旁边的单元格说“错误”。它应该说“正确”是在文本中找不到这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 "="

I tried to work with nested IF, but I couldn't get it to work. I kept getting errors when adding the third character to the formula.

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

1 个解决方案

#1


3  

Try this

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

or prefereably this one

或者优选这一个

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

See image for reference.

见图片以供参考。

使用Excel在单元格中查找某些字符

#1


3  

Try this

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

or prefereably this one

或者优选这一个

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

See image for reference.

见图片以供参考。

使用Excel在单元格中查找某些字符