Abbreviation Combination

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
200
Office Version
  1. 2013
Platform
  1. Windows
Hello People, hope you are doing well.

I am looking for your expert help.

Column F have product name & Column G have abbreviations of these product names. In column A we have multiple products which are present in mapping table i.e. Column F&G.

Based on this mapping table I want to populate product Abbreviations in column B using column A. I am also fine with UDF function.

abbrevation combination.xlsx
ABCDEFG
1ProductAbbreviationMapping Table
2PayablesPayProductAbbreviation
3Receivables, PayablesRec, PayPayablesPay
4Merchant services, FX, Card, PayablesMS, FX, Card, PayReceivablesRec
5FX, PayablesFX, PayMerchant servicesMS
6Card, ReceivablesCard, RecFXFX
7CardCard
Sheet1
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
If you are on Excel 365, try
Excel Formula:
TEXTJOIN(", ",1,XLOOKUP(TRIM(TEXTSPLIT(A2,",",,1)),TRIM($F$3:$F$7),$G$3:$G$7,"",0,1))
 
Upvote 0
A VBA solution.

VBA Code:
Sub pSplit()
Dim r As Range:         Set r = Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
Dim AR() As Variant:    AR = r.Value2
Dim LK() As Variant:    LK = Range("F3:G" & Range("G" & Rows.Count).End(xlUp).Row).Value2
Dim cmb As Object:      Set cmb = CreateObject("System.Collections.ArrayList")
Dim res As Object:      Set res = CreateObject("System.Collections.ArrayList")
Dim tmp() As String

For i = 1 To UBound(AR)
    tmp = Split(AR(i, 1), ", ")
    cmb.Clear
    For Each t In tmp
        For j = 1 To UBound(LK)
            If LK(j, 1) = t Then cmb.Add LK(j, 2)
        Next j
    Next t
    res.Add Join(cmb.toArray, ", ")
Next i

r.Offset(, 1).Value = Application.Transpose(res.toArray)

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top