Convert to common names based on conversion list

Sontauzo

New Member
Joined
Mar 13, 2018
Messages
18
Hello All,

I am trying to convert information from two different systems to the same naming system so that i can compare and analyze the data. Each system has a product number and name for each item. My trouble is that the numbers and names are different between the systems. I am wondering if there is a way for Excel to look at a static list of part numbers and convert the names of the products to the same nomenclature.

Right now the data is all housed in the same Workbook, but on different sheets (Storage and Usage). I would like to set up a Sub that would look at each sheet, compare it to the conversion list (on a separate worksheet named "Conversion"), and replace the names on the Storage/Usage sheets to the indicated value on the Conversion sheet.

This is how the "Conversion" sheet is set up. The actual list is much longer, but the information is in columns A, B, and C. On the Storage sheet the part number is in column "R", and it is in column "D" on the Usage sheet.

Storage Part #Common NameUsage Part #
30Hammer001
12Shovel060
864Screwdriver217
38Nails113
21Screws681
10Tarp941
17Saw374
95Paint662
66Ladder062

<tbody>
</tbody>

I am not even sure if what i am trying to do is possible, but thank you in advance for your time and help.

Thanks,

BWL
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You can use formulas to do this


Excel 2010
RS
1part#name
230Hammer
312Shovel
4864Screwdriver
538Nails
621Screws
710Tarp
817Saw
995Paint
1066Ladder
Storage
Cell Formulas
RangeFormula
S2=VLOOKUP(R2,Conversion!$A$2:$B$10,2,0)
S3=VLOOKUP(R3,Conversion!$A$2:$B$10,2,0)
S4=VLOOKUP(R4,Conversion!$A$2:$B$10,2,0)
S5=VLOOKUP(R5,Conversion!$A$2:$B$10,2,0)
S6=VLOOKUP(R6,Conversion!$A$2:$B$10,2,0)
S7=VLOOKUP(R7,Conversion!$A$2:$B$10,2,0)
S8=VLOOKUP(R8,Conversion!$A$2:$B$10,2,0)
S9=VLOOKUP(R9,Conversion!$A$2:$B$10,2,0)
S10=VLOOKUP(R10,Conversion!$A$2:$B$10,2,0)



Excel 2010
DE
1Part#
21Hammer
360Shovel
4217Screwdriver
5113Nails
6681Screws
7941Tarp
8374Saw
9662Paint
1062Ladder
usage
Cell Formulas
RangeFormula
E2=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D2,Conversion!$C$2:$C$10,0))
E3=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D3,Conversion!$C$2:$C$10,0))
E4=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D4,Conversion!$C$2:$C$10,0))
E5=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D5,Conversion!$C$2:$C$10,0))
E6=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D6,Conversion!$C$2:$C$10,0))
E7=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D7,Conversion!$C$2:$C$10,0))
E8=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D8,Conversion!$C$2:$C$10,0))
E9=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D9,Conversion!$C$2:$C$10,0))
E10=INDEX(Conversion!$B$2:$B$10,MATCH(usage!D10,Conversion!$C$2:$C$10,0))



Excel 2010
ABC
1Storage Part #Common NameUsage Part #
230Hammer1
312Shovel60
4864Screwdriver217
538Nails113
621Screws681
710Tarp941
817Saw374
995Paint662
1066Ladder62
Conversion
 
Upvote 0
Scott,

Thank you for your help. I have a couple of other applications that the formulas will work for. However, for the main workbook that I am dealing with, I am thinking that a Macro will work better. If i use the formulas on that sheet, i would have to go into each sheet and enter the formulas every time a report is generated. I am hoping to be able to run a Macro and convert all of the names on both sheets with one button click instead of entering the formulas each time.

BWL
 
Upvote 0
What are exact sheet names and what columns are used for what data in each? If you could post a sample of each sheet that would help.
 
Upvote 0
You will need to change the cell references and sheet names to match your data

Code:
Sub partnames()
Dim con As Worksheet
Dim stor As Worksheet
Dim useage As Worksheet
Dim lrc As Long
Dim lrs As Long
Dim lru As Long

Set con = Sheets("Conversion")
Set stor = Sheets("Storage")
Set useage = Sheets("Usage")

lrc = con.Cells(Rows.Count, "B").End(xlUp).Row [COLOR=#008000]'find last row in conversion sheet[/COLOR]
lrs = stor.Cells(Rows.Count, "R").End(xlUp).Row [COLOR=#008000]'find last row in storage sheet[/COLOR]
lru = useage.Cells(Rows.Count, "D").End(xlUp).Row[COLOR=#008000] ' find last row in useage sheet[/COLOR]

For s = 2 To lrs '[COLOR=#008000]loop though storeage sheet looking up part # in column S from row 2 to end of data[/COLOR]
    stor.Cells(s, "S") = Application.VLookup(stor.Cells(s, "R"), con.Range("A2:B" & lrc), 2, 0)
Next s
For u = 2 To lrs [COLOR=#008000]'loop though usage sheet looking up part # in column D from row 2 to end of data[/COLOR]
    useage.Cells(u, "E") = Application.Index(con.Range("B2:B" & lrc), Application.Match(useage.Cells(u, "D"), con.Range("C2:C" & lrc), 0))
Next u

End Sub

Test this on a copy of your data. You can then assign this to a button. You will need to save the file as a macro enabled file type like xlsm
 
Last edited:
Upvote 0
I will try to lay out all of the details. I apologize that my other posts weren't clear.

On the "Storage" worksheet the raw data looks like this...
Storage Part # (Column "R")Name (Column "S")
30Hammer (type 2)
12Shovel-blue
864Screwdriver large
38Nails #16
21Screws #7
10Tarp - black
17Saw-hand
95Paint-red
66Ladder-small

<tbody>
</tbody>

The "Usage" worksheet looks like this...
Usage Part # (Column "G")Name (Column "H")
001Large Hammer
060Blue Shovel
217#2 Screwdriver
113Nails-16
681Screws-7
941Black Tarp
374Handsaw
662Red Paint
062Small Ladder

<tbody>
</tbody>

The "Conversion" Worksheet looks like this... (columns A, B, and C)
Storage Part #Common NameUsage Part #
30Hammer001
12Shovel060
864Screwdriver217
38Nails113
21Screws681
10Tarp941
17Saw374
95Paint662
66Ladder062

<tbody>
</tbody>

The macro needs to check the Storage Part number in column "R" against Column "A" of the Conversion sheet. When it finds a match, it should take the corresponding Conversion column B value and overwrite the Storage Column S value. See below. The same type of check needs to be done on the Usage sheet as well. Check the Usage part number against Column "C" of the Conversion sheet. When it finds a match, take the corresponding Conversion Column "B value and overwrite the Usage Column "H" value.

These would be the results in the "Storage" sheet after the macro goes through and changes Column "S".
Storage Part # (Column "R")Name (Column "S")
30Hammer
12Shovel
864Screwdriver
38Nails
21Screws
10Tarp
17Saw
95Paint
66Ladder

<tbody>
</tbody>


These would be the results in the "Usage" sheet after the macro goes through and changes Column "H".
Usage Part # (Column "G")Name (Column "H")
001Hammer
060Shovel
217Screwdriver
113Nails
681Screws
941Tarp
374Saw
662Paint
062Ladder

<tbody>
</tbody>


I hope this helps. I know that this seems very convoluted, but the bottom line is that the two systems that we use have different names for the exact same product. I need a macro to go through each sheet and change the names to a Common Name (as designated in the Conversion sheet). Once the names are the same, I can run analytics on the data, but right now there is no common ground between the two systems so I can't combine anything.

Thanks in advance for your time.

BWL
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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