Compiling data from different worksheets based on a criteria

xlbaby

New Member
Joined
Nov 5, 2012
Messages
39
The situation I have is unique and I need you guys help on resolving it.

I have two sets of data files:

  1. First file has a lot of details such as the credit card number, the begin and expiry date of the credit card, outstanding balance, maximum balance available, current balance available, customer name and a customer relationship number. This customer relationship number is a unique number and is never assigned to another customer.
  2. Second file has additional details such as the customer name, bank account number, current account balance, Loan application Yes/No, Phone number, address, e-mail id and customer relationship number. This customer relationship number is the same as the one on the first file.
    For e.g. If customer XYZ has been assigned a relationship number of 23675 in the first file, that same customer relationship number is reported for XYZ on file 2.
I have a separate file saved as Masterfile where the first tab is named as” Compiled data”. What I need is a macro which will pull the necessary information from the first and second file based on the customer relationship number.

This master file has all the headings reported on first and second file. The macro needs to consolidate the details from the first and second file based on the customer relationship number. The macro also has to make sure that the right details are pulled from the right column.

For e.g. if phone number of XYZ is on column L of the 2nd file and credit card number is on column G of the 1st file, the macro should pull these two details from the 1st and 2nd file and compile it under the same headings within “compiled data” tab of Masterfile. One thing I should say is that Credit card number and phone number will not be in column L and column G in Masterfile. The credit card number is in column C and phone number is in column N as shown below. I am not sure whether this information is relevant but I just wanted to share it with you.


ABCDEFGHIJKLMN
Customer Relationship NumberCustomer name addressCredit Card NumberBank Account NumberBegin DateLoan Application Yes/NoExpiry DateOutstanding BalanceMaximum BalanceCurrent BalanceCurrent Account Balance e-mail idPhone number
23675XYZABC Villa, DEF street, US1234-56-78-90006863946989/24/2016No9/24/20202000010000080000174720xxx@hjtu@thisistest.com1-212-00-000
First and second fileFirst and second fileSecond fileFirst fileSecond fileFirst filesecond fileFirst fileFirst fileFirst fileFirst filesecond filesecond filesecond file

<tbody>
</tbody>


I hope I made it clear for you guys. Please let me know if you require any additional information.
 
I had a look at your files and the problem I can see is that you have an extremely large number of columns in each file. The master file also has many duplicate headers. Trying to manipulate all these headers is very difficult. It looks like all the headers in the Master don't have corresponding headers in the other two files. To be honest with you, it would take too much time to try and figure out which columns in the Master you want to populate with data from the other two files. If you can provide a copy of your Master marking only those columns which you want updated with data from the other two files, then maybe we can go from there.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
mumps,

Unfortunately all the fields in master needs to be updated. I will make sure that all the fields in master is having the same fields in both files 1 &2. What I was thinking is to split your macro in 2 separate modules and run it individually. Do you think it will work out?

Thanks a lot for your help.
 
Upvote 0
The duplicate headers in the master would make that impossible. For example, the header "Total Tax Paid by Employer" is duplicated nine times in the Master file. If all these columns have to be updated, unless they will all be updated with the same value, Excel has no way of distinguishing among the 9 columns because they all have the same name. The same would apply to the other duplicate column names.
 
Upvote 0
Thank you for your guidance. I will change it accordingly and test it out and will give you an update soon.

Again, thank you for your macro, guidance and help on this.
 
Upvote 0

Forum statistics

Threads
1,215,357
Messages
6,124,482
Members
449,165
Latest member
ChipDude83

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