使用 excel 公式检查列表中的任何一个单词是否存在于字符串中(没有 space)
check any one of a word of a list is present in a string (without space) using excel formula
我需要检查给定单元格中是否存在列表中的任何一个词
示例:
我已经使用 https://www.exceldemy.com/return-value-if-cells-contain-certain-text-from-a-list/ 中的所有选项进行了测试
但是,由于我的字符串没有 space
,因此其中 none 可以正常工作
这将在 VBA 为您完成:
Dim SearchStrings As Range
Dim FindRange As Range
'This is the range of cells to check
For Each SearchStrings In Range("A1:A6")
'This is the range of cells to compare
For Each FindRange In Range("G1:G3")
If InStr(SearchStrings.Value, FindRange.Value) Then
'Do whatever it is you want to do with the match result here
'I've just done a Debug.Print for demonstration.
Debug.Print (SearchStrings(, 1).Value)
End If
Next FindRange
Next SearchStrings
我需要检查给定单元格中是否存在列表中的任何一个词
示例:
我已经使用 https://www.exceldemy.com/return-value-if-cells-contain-certain-text-from-a-list/ 中的所有选项进行了测试 但是,由于我的字符串没有 space
,因此其中 none 可以正常工作这将在 VBA 为您完成:
Dim SearchStrings As Range
Dim FindRange As Range
'This is the range of cells to check
For Each SearchStrings In Range("A1:A6")
'This is the range of cells to compare
For Each FindRange In Range("G1:G3")
If InStr(SearchStrings.Value, FindRange.Value) Then
'Do whatever it is you want to do with the match result here
'I've just done a Debug.Print for demonstration.
Debug.Print (SearchStrings(, 1).Value)
End If
Next FindRange
Next SearchStrings