I have two columns in excel
A and B
I want to compare both and highlight where there is a match, however it is not a direct comparison
Column A has data like this
ABC123
whereas Column B only has
123
So I want to find 123 in Column A from Column B and highlight the match.
I need to do this for 9000 records
Pleas help
=IF(ISNUMBER(SEARCH(B1,A1)),"Match","")
This in column C will work for you.
What this does is use Search(find text,in text,[position])
to see whether the exact string appears in column A. If it does it will return a number (the position that this string starts in) so =IF(ISNUMBER(
can use that data accordingly.
You can do this without additiona formula's and VBA as well. Make a conditional format on cell B1 that is a formula:
=NOT(ISERROR(SEARCH(B1,A1)))
Note: Make sure that the values are B1 and A1, NOT $B$1 and $A$1.
Under Applies to fill in "B:B". Add a nice format for matched values.
An option is to strip out the letters from column A and try a direct match
You can use a UDF for this
Public Function StripChar(strInput As String) As String
Dim i As Long: For i = 1 To Len(strInput)
If IsNumeric(Mid(strInput, i, 1)) Then StripChar = StripChar + CStr(Mid(strInput, i, 1))
Next i
End Function
Then you can either use a helper function or direct conditional formatting with the following formula:
=IF(StripChar(A2)=TEXT(B2,"0"),TRUE,FALSE)
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.