2 columns w/ text data that i want to do a wildcard comparison

  • Thread starter Thread starter dellsilv
  • Start date Start date
D

dellsilv

iN eXCEL, I HAVE 2 COLUMNS AS SUCH:

A A EXACTMATCH
A B NOMATCH
A1 1 PARTIALMATCH
IS MISS PARTIALMATCH
X NOMATCH

I need to do a wildcard comparison between column A to column B and place in
Column C the resulting match type.
 
you can create a User Defined Function (aka UDF) for this as follows.

In a standard code module paste this:

Option Explicit
Function MatchType(textA As String, textB As String) As String
If textA = textB Then
MatchType = "EXACTMATCH"
ElseIf InStr(textA, textB) > 0 Then
MatchType = "PARTIALMATCH"
ElseIf InStr(textB, textA) > 0 Then
MatchType = "PARTIALMATCH"
Else
MatchType = "NOMATCH"
End If
End Function
 
Back
Top