VBA - Using the output from one array to return a value from another array

Mike UK

New Member
Joined
Dec 14, 2011
Messages
41
I have a large array of around 15,000 lines. Each output row contains two fields with a meaningless code. I have two mapping tables to translate these codes (see mocked up idea below). The mapping tables need to be contained within the VBA code rather than a separate sheet using VLookup. I could create two arrays and get the code to loop through each mapping table to replace the code with the name but with 15,000 lines within the main array is this the most efficient way? So for example output row 5623 from the main array could have store code E in one field and Code A02 but I need to replace with meaningful names.

StoreNameCodeFruit
ABrowns GrocersA01Orange
BTescoA02Apple
CSainsburyA03Banana
DAldiA04Grapes
EWaitroseA05Strawberries
FAsdaA06Kiwi
GOcadoA07Raspberries
HMarks & Spencer
 
It will still loop the whole array but if
A1=Tesco and A11 =Ocado
If it replaces A1 before A11 and you had data like Col A
Book1
ABC
1Should beResult
2A1TescoTesco
3A11OcadoTesco1
Data

Sorry for the delay in replying. Once gain thanks for your insight and help.
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

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