Consulting

Results 1 to 3 of 3

Thread: VBA to extract data from 2 excels

  1. #1

    VBA to extract data from 2 excels

    Hello,

    I have 2 excels and I want to extract data using VBA based on match criteria on 2 columns. That is:

    Excel1 has these 4 columns JoinDate, FirstName, LastName, Address.

    Excel2 has these 9 columns: Transaction Type, Transaction Date, Transaction Number, FirstName, LastName, ProductCode, ProductName, Product Date, Payment Amount.

    I would like to:

    1) Read Excel1 sequentially
    2) For every row having FirstName, LastName, find matches for the same FirstName, LastName in Excel2
    3) Please note that Excel2 can have multiple rows matching for FirstName and LastName. I want to extract all the relevant rows matching with FirstName and LastName
    4) Once the match is found, I want to extract these data: ProductCode, ProductName & TransactionDate and output to a 3rd excel, Excel3.
    5) Excel3 format is: FirstName, LastName, ProductCode, ProductName, TransactionDate.

    Need help to code this using VBA? Appreciate anyone sharing sample VBA source on this

    Thanks

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Can you post sample data and any coding you have tried?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    I am completely new to VBA world and the only thing I know in excel are playing with some formulaes. I have tried advanced filter options, but it did not seem like it can do this. I then tried a sample code from couple of other online sites on how to compare 2 worksheets, but it did not help.
    I have collapsed sample data from 2 excels and also included the sample output data and attaching here.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •