+ Reply to Thread
Results 1 to 17 of 17

Identify matching data in different rows and put into same row in new worksheet

  1. #1
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    Identify matching data in different rows and put into same row in new worksheet

    This is the procedure I want to create. I also attached a workbook that demonstrates what I am trying to accomplish. The code I am using is posted below as well as the problems I am having with it.

    1. Go to Sheet “Original” look at the data in cell A1 then look for a match of that data in the rows of Column C, Column F, Column H, Column J, Column L, Column N, and Column P

    2. Once matches for Column A are found in the different rows of Column C, Column F, Column H, Column J, Column L, Column N, and Column P then copy the matching row of Column A:B, Column C:E, Column F:G, Column H:I, Column J:K, Column L:M, Column N:O, and Column P:R

    3. Next paste the different rows from Column A:B, Column C:E, Column F:G, Column H:I, Column J:K, Column L:M, Column N:O, and Column P:R into Sheet “Matched” so they are in the same row instead of different rows.

    4. Repeat the process for every row in Column A

    5. Carry over any extra rows with data from Column A:B, Column C:E, Column F:G, Column H:I, Column J:K, Column L:M, Column N:O, and Column P:R that did not have matches in Column A, Column C, Column F, Column H, Column J, Column L, Column N, and Column P.

    Please Login or Register  to view this content.
    The macro is grabbing A:B, C:E, and P:R and putting them into the same row in Sheet Matched, but the code is missing everything else I would like to see happen. Can you help me figure out what I need to change in this macro in order to make it work? See attached workbook. Thank you for your help.
    Attached Files Attached Files
    Last edited by Sal1; 08-03-2010 at 12:12 AM. Reason: SOLVED

  2. #2
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Identify matching data in different rows and put into same row in new worksheet

    Hi All, just wondering if anyone had any ideas on how to fix this? Thanks for your time.

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

    Re: Identify matching data in different rows and put into same row in new worksheet

    Here's how I would write that:
    Please Login or Register  to view this content.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Identify matching data in different rows and put into same row in new worksheet

    Thanks Man! I appreciate your kindness to help me. Maybe this is my error. When I entered the code into the workbook that is attached to this thread and ran it I received an error message that said 'No cells were found' and this line of the code was highlighted

    Please Login or Register  to view this content.
    I am not sure what it could be, do you know?

  5. #5
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: Identify matching data in different rows and put into same row in new worksheet

    I think you get this error when no SpecialCells are found.
    This may help:-

    Please Login or Register  to view this content.
    hth
    Ajay

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

    Re: Identify matching data in different rows and put into same row in new worksheet

    That's a concern if you tried on the posted file. Did you insert the macro into a standard module? (Insert > Module)

    The sample file has constants in column A so the RNG should set properly.

    If you continue to get the error, post your file again with the macro installed and the workbook misbehaving so we can look at it together.

  7. #7
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Identify matching data in different rows and put into same row in new worksheet

    ajaykgarg this works very well; thank you for your help!

  8. #8
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    SOLV: Identify matching data in different rows and put into same row in new worksheet

    JBeaucaire; you are correct the way I entered the macro made the difference. Once I did it the way you instructed me to do everything worked perfectly. Thank you for your patience and help; I appreciate it very much!
    Last edited by Sal1; 07-26-2010 at 09:23 PM. Reason: SOLVED

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

    Re: Identify matching data in different rows and put into same row in new worksheet

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  10. #10
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Identify matching data in different rows and put into same row in new worksheet

    Hi JBeaucaire,

    Thank you again. I just realized the macro will not work if the data in sheet ‘Original’ is not color coded. I set up the workbook that way to make it easier to understand my objective however I did not specify the data would not be color coded in the instructions; my apologies. Is it possible to modify this macro so it still works if the data in sheet ‘Original’ is not color coded? Thank you for your help!

    Please Login or Register  to view this content.

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

    Re: Identify matching data in different rows and put into same row in new worksheet

    My macro isn't doing anything with color coding. It functions strictly off of the values in the cells.

    If you're experiencing specific difficulty, upload a new exemplary workbook.

  12. #12
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Identify matching data in different rows and put into same row in new worksheet

    Thank you JBeaucaire. I reattached the workbook here. You are very kind! Just to give you an idea. Perhaps my error but when I remove the colors
    Please Login or Register  to view this content.
    this part of the code is highlighted. If I add
    Please Login or Register  to view this content.
    then this part of the code
    Please Login or Register  to view this content.
    gets highlighted. Also if I leave the colors alone the code works once but if I delete everything from Sheet 'Matched' and try to use the code again this part
    Please Login or Register  to view this content.
    gets highlighted in yellow with an error message. This workbook is different from the original because I removed the colors and added dashes to some of the data; I have the same problems without dashes. Any input is greatly appreciated.
    Attached Files Attached Files
    Last edited by Sal1; 07-30-2010 at 12:08 AM.

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

    Re: Identify matching data in different rows and put into same row in new worksheet

    I had similar problem until I retyped your sheetname, no idea why, they looked the same to me.

    I also removed all the extra baggage on the MATCHED sheet for now so the macro can display in its pure form, with only a series of values in column A to match.

    My version of your workbook has the macro in it, a couple of small tweaks.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Identify matching data in different rows and put into same row in new worksheet

    Wow! This is awesome. I noticed if some data is not in Column A on sheet 'Matched' but is in a Column on sheet 'Original' the data will not come over to sheet 'Matched'. Is there a way to get the remaining data from the same column of 'Original' over to the same column of "Matched' even though it does not have a match in Column A?

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

    Re: Identify matching data in different rows and put into same row in new worksheet

    Not offhand. That would be a whole new process.

    Mockup what the organized final output would look like for the unmatched values.

  16. #16
    Registered User
    Join Date
    04-20-2009
    Location
    Cloverly, Maryland
    MS-Off Ver
    Excel 2003
    Posts
    60

    SOLV: Identify matching data in different rows and put into same row in new worksheet

    Thank you JBeaucaire; I appreciate your help!
    Last edited by Sal1; 08-02-2010 at 11:22 AM. Reason: SOLVED

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

    Re: Identify matching data in different rows and put into same row in new worksheet

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED .

+ 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