Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
meatpath
Feb 13, 2003

My question:

I have a list of several hundred objects that are posted each week at work from two different outside vendors. Each list is of the same objects, but each vendor abbreviates some of them differently.

For example, vendor #1 sends me a list that looks like this in a column:

code:
Name A
Name B
Name C
Name D
Name E
While vendor #2 sends me a list of the exact same objects that looks like this:

code:
Name A
Nm. B
Nm. C
Name D
Nm. e
Each list has corresponding data in adjacent columns. Basically, I want to be able to combine both lists - since they are listing the same objects - and transfer all data into one worksheet that can be analyzed. The list of objects will be exactly the same each week, so static rules for cell changes can be utilized. The problem is that, when the second vendor abbreviates objects, it throws them out of sync alphabetically and does not allow for easy sorting and combining.

I have never really gotten too deep with macros in Excel before, but I'm thinking all I really need is basically a "Find and Replace" macro that can have a set of rules on what objects are to be replaced each week in list B to make it exactly the same as list A. In other words, every week I will need to change the exact same abbreviation into its full name. Something like "Change 'Nm. B' to 'Name B', then change 'Nm. C' to 'Name C', then change 'Nm. e' to 'Name E'" and so on.

I hope that makes sense. I'm not asking anyone to write the macro, I just don't really know where to start or if this is possible. Obviously, the easier solution would be to just implement consistency between the sources, but we don't really have any control of how the vendors setup their database.

Adbot
ADBOT LOVES YOU

meatpath
Feb 13, 2003

Sub Par posted:

Edit: if I'm not understanding it right, you could probably just turn on the macro recorder and then manually do all the finding/replacing you want, and then stop the recorder and have a look at the code in the vba editor. It's pretty straightforward to adapt the recorded macro for your own purposes.

I actually started this process, but then before I got very far I realized that I could solve my problem by simply building a "corrected" list that I keep in a separate file and just copy and paste onto the lovely list every week before actually sorting it alphabetically, that way I can preserve the corresponding data during the sort. Not sure why I didn't think of this solution before, but whatever. Thanks for the response.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply