+ Reply to Thread
Results 1 to 8 of 8

Compare multiple sets of columns

  1. #1
    Registered User
    Join Date
    08-18-2013
    Location
    South Korea
    MS-Off Ver
    Excel 2007
    Posts
    4

    Compare multiple sets of columns

    I have a large amount of data (each column has at least 300 data, more or less, and I have about 3000 columns). Also, for each column (say, column A), I have a corresponding, smaller column (Column B). It looks like this:

    Column A (empty column) Column B (empty column) Column C (empty column) Column D

    Column A and B go together, and C and D go together, and so forth. Columns A, C, (every odd columns) have the same values as Columns B, D (every even columns) but they are larger in size. So I guess you can say column B is included in column A. What I would like to do is to look for the duplicate values in each pair of the columns and remove the same values. I've tried a macro that I've written myself below:

    ==========================
    Please Login or Register  to view this content.
    ========================================

    but I keep getting mismatch 13 errors and whatnot. Could you guys help me out a little bit? Thank you so much!
    Last edited by bseo927; 08-19-2013 at 03:37 AM. Reason: As per Forum Rule #3, please use code tags…Thanks.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Compare multiple sets of columns

    Hi, bseo927,

    maybe try it like this:

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    08-18-2013
    Location
    South Korea
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Compare multiple sets of columns

    Thanks a lot for the input! However, I keep getting mismatch 13 error

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Compare multiple sets of columns

    Hi, bseo927,

    can´t find any reason for the run time error from the code. Maybe you can attach a workbook with some sample data in order to check the code - I created a sample workbook for testing and the code worked fine there.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    08-18-2013
    Location
    South Korea
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Compare multiple sets of columns

    Here's a sample of my data. There are a lot more columns but I'll just show you a few. For each three data pair, x-1 includes x-2 as you can see, and I would like to remove the duplicate values in x-1 sets of data. Worksheet.xlsxThanks!

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Compare multiple sets of columns

    Hi, bseo927,

    I´m not sure why Application.Match doesn´t match up on the value but Find should do.

    Please Login or Register  to view this content.
    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    08-18-2013
    Location
    South Korea
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Compare multiple sets of columns

    This actually worked! I just ran the code and though slow, it did its job! Now I have to wait about an hour for excel to do its thing for other data files Thanks a lot!!!!!

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Compare multiple sets of columns

    Hi, bseo927,

    you could use Application.ScreenUpdating = False at the beginning of the code and Application.ScreenUpdatng = True at the end - as the screen would not refresh the macro speed should increase considerably. If there are forumulas which need to be calculated you could turn calculation to manual as well and back to automatic at the end. And if there are events behind the sheet you could turn them off by Application.EnableEvents = False and back on by passing the argument as True at the end.

    Ciao,
    Holger

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 07-25-2013, 03:20 PM
  2. Comparing multiple sets of columns for greater values
    By metsfan666 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-09-2012, 08:41 PM
  3. Replies: 2
    Last Post: 12-05-2012, 01:52 PM
  4. To convert data in multiple sets of columns to multiple rows
    By Dhanya_nair in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2012, 02:49 PM
  5. Replies: 1
    Last Post: 01-08-2012, 08:34 PM

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