this may be a bit difficult to explain but i will use the example below
as you can see, the excel sheet has two columns (C and F) I was able to use conditional formatting to highlight the duplicate cells with the green color. I would like to know how to also two different cells that contain multiple words with at-least one word in each cell being the same, as you can see the cells with the yellow color. thanks
You can use a UDF below to compare the values
Public Function comparecells(cell1 As String, cell2 As String) As Boolean
'store words of each cells in two diffrent arrays
array1 = Split(cell1, " ")
array2 = Split(cell2, " ")
'reset the function value
comparecells = False
'check each word from one array against the other
For Each Value1 In array1
For Each Value2 In array2
If Value1 = Value2 Then
'If it finds any match set function return value to true and exit
comparecells = True
Exit Function
End If
Next Value2
Next Value1
End Function
Here's a formula for conditional formatting which will return TRUE if at least a word matches.
This is written for cell C2 and it is assumed that it is looking for values in cells F2 to F15.
=NOT(ISERROR(LOOKUP(2^15,SEARCH(TRIM(MID(SUBSTITUTE(" "&C2," ",REPT(" ",99)),{1,2,3}*99,99)),F2:F15,1),F2:F15)))
Adjust it to suit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.