+ Reply to Thread
Results 1 to 5 of 5

how to match and pick excel data

  1. #1
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    how to match and pick excel data

    I have data in two separate Excel files.

    Excel 1: column:> Location - Code - weight


    Excel 2 : column:> Location - Code - weight


    I want to dump data in a new Excel file for common Location in these Excel file but code and weight will be from Excel 2 only.


    Please see this Sample data:
    ----------------

    Excel 1:
    -----------
    Location ------Code-----Weight
    Paris 12 40
    Germany 15 25
    Africa 17 15


    Excel 2:
    -------------
    Location ------Code-----Weight
    Paris 78 34
    Spain 15 25
    Madrid 24 54


    As you see Paris is a common location in this two excel , so I'll pick this location ...also I'll pick code and weight from Excel 2 .

    so new Excel will dump this data ..
    New Excel:
    ---------------------
    Location ------Code-----Weight
    Paris 78 34


    I have more than 15000 data in these excels which I need to compare and pick and have to put in a new excel through this logic. Please suggest me a workaround


    I am a Excel user ...not an excel programmer. Can you suggest a solution from end user's perspective.

    I'm using Office Version: 2007
    Last edited by zerodegree; 02-02-2013 at 01:31 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to match and pick excel data

    You don't really need a macro for this, the steps below shouldn't take more than a couple of minutes.

    1) Open both documents
    2) Copy the Excel2 sheet into the Excel1 workbook as a new sheet, let's assume the results are Excel1 = Sheet1 and Excel2 = Sheet2

    3) Now on sheet2 in empty column D put this formula in D2
    =ISNUMBER(MATCH(A2, Sheet1!A:A, 0))
    4) Copy that D2 cell down the entire data set, a series of TRUE/FALSE answers will appear.

    5) Highlight row1 and turn on the Data > Filter
    6) Filter column D for TRUE
    7) Highlight the visible rows and copy them to a new workbook

    8) Close the two original workbooks without saving any changes you made, thus the original workbooks are pristine
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: how to match and pick excel data

    Quote Originally Posted by JBeaucaire View Post
    You don't really need a macro for this, the steps below shouldn't take more than a couple of minutes.

    1) Open both documents
    2) Copy the Excel2 sheet into the Excel1 workbook as a new sheet, let's assume the results are Excel1 = Sheet1 and Excel2 = Sheet2

    3) Now on sheet2 in empty column D put this formula in D2
    =ISNUMBER(MATCH(A2, Sheet1!A:A, 0))
    4) Copy that D2 cell down the entire data set, a series of TRUE/FALSE answers will appear.

    5) Highlight row1 and turn on the Data > Filter
    6) Filter column D for TRUE
    7) Highlight the visible rows and copy them to a new workbook

    8) Close the two original workbooks without saving any changes you made, thus the original workbooks are pristine
    what this part is doing ? Sheet1!A:A ?
    Last edited by zerodegree; 02-03-2013 at 02:18 AM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to match and pick excel data

    If you followed the instructions it would become clear visually. We trying to "match" the value in sheet2's cell A2 to anywhere in Sheet1's column A. If a match occurs, it returns a number to the MATCH() function. Since the MATCH() function is wrapped inside an ISNUMBER() test, that results in TRUE if a number occurs for the match, and a FALSE if no number appears because there is no match.

    Once you copy that formula down you will clearly see the TRUE/FALSE results for the matches. Then an Autofilter is used to copy the matches (TRUE) to another sheet.

  5. #5
    Registered User
    Join Date
    02-02-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    62

    Re: how to match and pick excel data

    Quote Originally Posted by JBeaucaire View Post
    You don't really need a macro for this, the steps below shouldn't take more than a couple of minutes.

    1) Open both documents
    2) Copy the Excel2 sheet into the Excel1 workbook as a new sheet, let's assume the results are Excel1 = Sheet1 and Excel2 = Sheet2

    3) Now on sheet2 in empty column D put this formula in D2
    =ISNUMBER(MATCH(A2, Sheet1!A:A, 0))
    4) Copy that D2 cell down the entire data set, a series of TRUE/FALSE answers will appear.

    5) Highlight row1 and turn on the Data > Filter
    6) Filter column D for TRUE
    7) Highlight the visible rows and copy them to a new workbook

    8) Close the two original workbooks without saving any changes you made, thus the original workbooks are pristine
    This works to some extent but not complete...I want to pick the Code and Weight from other sheet whenever a match is TRUE....I am stuck here now.

    I have put formula in Sheet1 ....I want Code and Weight to pick up from Sheet 2 for matching locations and want to make a new workbook....how do I do this part ?


    You know why I'm doing it ? its because ...Sheet1 has old data and Sheet2 has latest data....I'm trying to get the latest data from Sheet 2 but only for matching locations in both sheets.

    at the end of this work ...I want to have a final sheet of [locations(matching) , codes (latest data) and weights(latest data)]

    I want to apply formula in Sheet1 only...because there are some other data (which I did not post for simplicity) which I require in new workbook

    Hope you have got my objective.
    Last edited by zerodegree; 02-03-2013 at 02:13 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1