+ Reply to Thread
Results 1 to 7 of 7

Match / Index Multiple Columns and copy data

  1. #1
    Registered User
    Join Date
    08-06-2009
    Location
    Derby, England
    MS-Off Ver
    Excel 2003; Excel 2007
    Posts
    20

    Match / Index Multiple Columns and copy data

    hi,

    I've spent quite a few hours today trying to search for a solution to this and concluded it has something to do with Match and Index, but, can't for the life of me to get it all to work.

    I don't think it strictly has to be a macro - a formula may work - but this is what i want to do:

    In one sheet (called db) i have over 50,000 entries which relate to stock items seperated into style, colour, size and barcode.

    In the other sheet i have a download of my stock database (called stck) which (after some manipulation) also has columns split into style, colour and size. This has about 700 items in it.

    What i need to do is for all 700 items search through the db sheet and match style, colour and size, then copy the barcode from the db sheet to the stck sheet.

    I know it ***should*** be simple to do, but, i can't for the life of me work it out, so any help / advise / solutions would be really really appreciated.

    My excel sheet can be downloaded as a zip from here:
    http://www.surplushardwaresupplies.c...xcel/addbc.zip

    The upload utility keeps erroring on me for some reason, sorry...

    Thanks

    Mike
    Last edited by SHS; 04-07-2010 at 08:47 AM. Reason: Solved

  2. #2
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111

    Re: Match / Index Multiple Columns and copy data

    G'day SHS,

    Okay please do the following,

    Go to your 'bc' sheet and at cell F2 and enter

    =A2&B2&C2

    then if your in the formula bar exit out by pressing enter then return back to cell F2 then press CTRL+C then hit the left arrow once then hold down the CTRL key and press the down arrow. Then press the right arrow once then hold down the CRTL+SHIFT keys and press the up arrow then press CTRL+V.

    Now to your 'stck' sheet at cell H2 and format the cell 'Numbers' and now copy and paste the formula below

    Please Login or Register  to view this content.

    now copy drag down.

    HTH

    Cheers

    RC
    Last edited by ratcat; 04-07-2010 at 07:18 AM. Reason: Formula
    Have I made you happy ??? If yes, please make me happy by pressing the http://www.excelforum.com/images/buttons/reputation-40b.png Add Reputation button in my post.
    Please don't forget to do the same to other contributors of this forum.

    Thanks
    I don't void confusion, I create it

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Match / Index Multiple Columns and copy data

    I was going to suggest similar but using Binary Search INDEX/MATCH given the data on bc is already sorted appropriately.

    I was going to suggest a concatenation on bc sheet of:

    Please Login or Register  to view this content.
    Followed by summary calc of:

    Please Login or Register  to view this content.
    the above should prove to be a lot quicker than conducting exact matches over such a vast range
    (0 implies no match - a Custom Format can be used to have the 0's display however you want)
    Last edited by DonkeyOte; 04-07-2010 at 07:30 AM. Reason: removed COUNTIF and replaced with LOOKUP for efficiency

  4. #4
    Registered User
    Join Date
    08-06-2009
    Location
    Derby, England
    MS-Off Ver
    Excel 2003; Excel 2007
    Posts
    20

    Re: Match / Index Multiple Columns and copy data

    Perfect. Exactly what i needed, thank you very much.

    I had to play around with the sizes in the main db as they had a space, but that only took a few minutes and it now all works. Just a shame my supplier didnt provide me with all the barcodes for all my items

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Match / Index Multiple Columns and copy data

    Not sure which you opted for but I for one failed to add the SUBSTITUTE as I should have done to the concatenation formula such that it becomes:

    =SUBSTITUTE($A2&"@"&$B2&"@"&$C2," ","")
    copied down

    The other formula remains as was...

    I did a quick benchmark test between the exact match approach and the binary search ... using your file and on my machine (4GB RAM) the exact match takes around 4 secs to calculate (700 calcs) whereas the binary search takes around a hundreth of a second.

    Though 4 seconds is not long it does prove the gains that can be had from sorting and using binary search methods as only a fraction of the transactions are reviewed (savings will increase the greater the range / no. of calcs)

    EDIT: apologies for the edits - trying to word correctly such that it made sense.
    Last edited by DonkeyOte; 04-07-2010 at 08:58 AM.

  6. #6
    Registered User
    Join Date
    07-26-2010
    Location
    montreal, canada
    MS-Off Ver
    Excel 2007
    Posts
    4

    Exclamation Re: not solved ?

    Hello,

    I have tried to use both of these methods for my data. The second method did not work for me, and I have just realized that the first method doesn't even work for the original dataset. If you compare the 2 methods using the original dataset, you'll see that a large number of the barcodes don't show up with the first method, whereas they do with the second method. This suggests to me that there is something wrong with the formula being used, which is unfortunate for me because the other formula doesn't seem to work for me. If someone could fix the 1st formula I would like to try to use it, otherwise I will post my data and perhaps someone can adapt the second formula to it.

    thank you

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Match / Index Multiple Columns and copy data

    Hi shahin
    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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