Excel Macro Question

By randyw ·
I need to write a macro in Excel. I have an existing spreadsheet with data. I am importing in to a 2nd sheet a CSV file containing a list of data with basically an ID field and a quantity field. I want to take the ID field, and search to find a match on the original Excel sheet, and when I find it, take the number in the quantity field of the imported data and update the corresponding quantity field in the original sheet. The importaed data is variable, so it will different each time it's imported in, so I'm not searching for the exact same data each time, if that makes any sense. Is there an easy way to do this? Thanks.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Case of Lookup

by daniel In reply to Excel Macro Question

Did you consider using VLookup?

It will lookup the ID you are seeking in the imported .csv file and return the value in the column you specify.

Collapse -

Just be sure to sort both....

by ThumbsUp2 In reply to Case of Lookup

If you don't sort both on the same key, your VLookup will quit looking when it reaches a value above/beyond what you're searching for.

Related Discussions

Related Forums