Hey, please help
I need to compare 2 arra
First having titles like:
Manager-accounts
Manager - Sales
Officer - Accounts
Officer - HR
Supervisor-
Second having (this is not set in stone)
Manager
Officer
Supervisor
etc.
I want to compare the 2 array and then return the common term from the second array.
Result needs to be
Manager
Manager
Officer
Officer
Supervisor
I tried this code in module
Function StringMatch(ByVal sMaster As String, ByVal sSlave As String, Optional bMatchCase = False, Optional sDelimiter = " ") As String
Dim asMast() As String, asSlav() As String
Dim lWordLoop As Long
Dim sTemp As String
If Not bMatchCase Then
sMaster = UCase(sMaster)
sSlave = UCase(sSlave)
End If
asMast = Split(sMaster, sDelimiter)
asSlav = Split(sSlave, sDelimiter)
sTemp = ""
For lWordLoop = LBound(asMast) To UBound(asMast)
If Not IsError(Application.Match(asMast(lWordLoop), asSlav, 0)) Then
sTemp = sTemp & asMast(lWordLoop) & sDelimiter
End If
Next lWordLoop
If Len(sDelimiter) > 0 And Len(sTemp) > 0 Then
sTemp = Left(sTemp, Len(sTemp) - Len(sDelimiter))
End If
StringMatch = sTemp
End Function
Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
This only returns one cell at a time. Please help to make it or help me with a new code to compare array and return the second array.
Please Help!!
Arun Menon
Bookmarks