We help IT Professionals succeed at work.
Get Started

Copy data programmatically between Excel files

76 Views
1 Endorsement
Last Modified: 2019-11-24
I have two Excel files (examples attached).

I've labeled one a Master File and the other a Transaction file.

The Master File gets much, but not all, of it's data from the Transaction File.

Each file contains around 200 rows.

The data is not arranged in the same order between the files and the order of each can't be changed.

There is a row name for each data row in each file but no naming convention between the two files.

What I mean by that is that there are instances where:

1. a particular row in the Master File may be related to a row in the Transaction file where the row
names DON'T match and you can't tell they are related.
2. a particular row in the Master File may be related to a row in the Transaction file where the row
names DO match.
3. a particular row in the Master File may be related to a row in the Transaction file where the row
names DON'T match exactly but are close enough to be able to tell they are related.

For reasons I won't bother to get into, the row names can't be changed.

I also am not going to link the files.


What I'm looking to be able to do is:

1. From the Master File, be able to click on a button that will open windows explorer and allow me to navigate to theTransaction File I want to select for "import".

2. Upon selecting the file, the program will, starting with the first (data) row name of the Master File (the row names are contained in column A of each file), search the row names in the Transaction File and if and when it finds the namein the Transaction File that is related to the name in the Master File, write the data in column 2 of the applicable row of the Transaction File to column 2 of the applicable row of the Master File.

3. Once the entire Transaction File is searched and a match is not found or a match is found and written to the Master File, the program should advance to the next row of the Master File and repeat the process.  Do this until the end of the Master File is reached.

If you look at the attached files and my notes in them, you should be able to see what I'm looking to achieve.


Thank you.
Master-File.xlsx
Transaction-File.xlsx
Comment
Watch Question
Mechanical Engineer
CERTIFIED EXPERT
Most Valuable Expert 2013
Top Expert 2013
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE