This is a guest post written by Yoav Ezer. Many people use Microsoft Excel to work with external data sources, but of course in the real world data is not supplied in a clean, easy to use format. What can you do if you have multiple sources of data? For example, what about stores who are supplied updated product lists and prices from various vendors? Product codes might be similar, the same or different. In this tutorial, see how to cross find similar product codes in Excel.
We can still work with this data; it will just take a little additional Excel work. To solve this, first we need to make some assumptions:
- The original price list contains a Vendor ID for each product as well as a Product ID used by the reseller.
- A new price list from a vendor will contain the Vendor IDs, but not the reseller’s Catalog ID (of course).
- If the vendor ID is exactly the same, the price and description will be replaced automatically.
- If the vendor ID is similar the user will be prompted to replace the data; if declined, the new item will stay, marked as ‘new’.
- If there is more then one possible match, the user will be asked what to do.
How to Cross Find Similar Product Codes in Microsoft Excel : Our Solution
If you want to check out our solution you can download the spreadsheet Similar products.xlsm which provides our sample data and the required code.
The sheet contains two product lists, one original and one vendor-sent (“new prices”), and a sheet to put the merged list (“Merged Prices”). To run the solution, run the MergeProducts() macro (which will clear the merged list first).
How it Works
The first sheet (“Original Prices”) contains the list of current prices to be merged, including both the Catalog ID (of the reseller) and the Vendor ID (of the original vendor). The second sheet (“New Prices”) contains the list of updated prices from the vendor. The Catalog ID column is empty, of course. The third sheet (“Merged Prices”) will contain the merged list.
The merging algorithm works as follows:
1. Copy the new items to the merged list sheet
2. Mark them as new in a new column
3. Copy the old items to the merged list sheet below the new items
4. For each old item, check to see if it has an update:
- Go over the list of new items and create a list of similar vendor IDs
- If there are none, leave it
- If there is one
- If it’s exactly the same, automatically replace it (unless the flag is set to ask the user)
- Otherwise, ask the user whether to replace the data
- If there’s more then one, ask the user which one to use (or to keep the original one)
- If data is to be replaced, the original item’s data is removed, and the Catalog ID is moved to the new item
While this solution is pretty specific to our example and each implementation would have to accommodate different inputs, hopefully this article will show you what is possible. Even if your data sources are not supplied in a perfect state, Microsoft Excel still allows you to work with external information to get the results you want. Of course there is a little effort involved, but far less than working manually! How would you improve this process?
About the author
Yoav Ezer co-authors the technology and productivity blog Codswallop. He is also the CEO of a company that produces PDF to XLS conversion software.
For more Excel tips from Yoav, join him on Facebook or Twitter