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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,221,634
Messages
6,160,965
Members
451,681
Latest member
Northern NY Design

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