+ Reply to Thread
Results 1 to 16 of 16

vba compare arrays and remove exact matching arrays

  1. #1
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    vba compare arrays and remove exact matching arrays

    Hi
    I need help to create a vba that will compare all arrays to each other ,example listed below they are sepperated by 1 blank line and to remove any of them that have all 30 identical nrs in identical positions.(in this example the firs and last array are identical)

    30 16 32 36 15 23
    13 17 45 9 34 41
    27 31 33 39 25 37
    43 3 6 19 28 5
    12 22 10 26 24 18

    37 9 25 13 28 19
    22 43 17 16 31 41
    33 36 34 32 12 18
    45 10 26 15 6 27
    39 3 23 5 30 24

    17 39 31 19 37 34
    9 15 36 12 10 16
    43 25 26 3 33 22
    45 28 30 13 5 24
    18 6 23 41 32 27

    12 43 34 33 18 5
    6 26 15 9 28 30
    17 41 22 45 36 16
    25 37 10 27 13 19
    3 23 24 31 39 32

    30 16 32 36 15 23
    13 17 45 9 34 41
    27 31 33 39 25 37
    43 3 6 19 28 5
    12 22 10 26 24 18
    Attached Files Attached Files
    Last edited by jacojvv; 10-18-2013 at 04:51 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: vba compare arrays and remove exact matching arrays

    Please attach a sample workbook with enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Note: Please don't attach documents containing confidential data like (address, telephone, ID#s, etc.).


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vba compare arrays and remove exact matching arrays

    ok ive uploaded a mocup with a Include a BEFORE sheet and an AFTER sheet

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: vba compare arrays and remove exact matching arrays

    Try the below code…

    To Add Excel VBA Code to a Workbook / This Workbook Module

    1. Copy the code that you want to use
    2. Select the workbook in which you want to store the code
    3. Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    4. In the Project Explorer, find your workbook, and open the list of Microsoft Excel Objects
    5. Right-click on the ThisWorkbook object, and choose View Code
    6. Where the cursor is flashing, choose Edit | Paste

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vba compare arrays and remove exact matching arrays

    Hi
    Exactly what i needed thank you

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: vba compare arrays and remove exact matching arrays

    Glad it helps you and thanks for the feedback

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: vba compare arrays and remove exact matching arrays


  8. #8
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vba compare arrays and remove exact matching arrays

    ok found a bug..it only does up to 179 line where i currently have 19344
    could we let it loop all the way down

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: vba compare arrays and remove exact matching arrays

    Hi jacojvv,

    in your example file on sheet "After" 1st and 5th arrays are not the same?

  10. #10
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vba compare arrays and remove exact matching arrays

    Hi
    That is correct..the vba needs to search through the "before"sheet and remove any arrays that are identical(30 numbers in exactly the same positions)
    then i will end up with a set of unique arrays on the "äfter" sheet. the same numbers are used but their positions in the array are different...i just want to remove duplicates basically

  11. #11
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: vba compare arrays and remove exact matching arrays

    I may be mistaken, but take a look at the attached file
    Are there any differences in the 1st and 5th arrays on sheet "After"?
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vba compare arrays and remove exact matching arrays

    Hi
    the sheet after is what it should look like when the vba has completed running and removing duplicates.
    the sheet "before" is where the examples are of duplicates.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: vba compare arrays and remove exact matching arrays

    See if the attached works.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vba compare arrays and remove exact matching arrays

    Hi jindon
    This seems to work much better thank you..will keep you posted

  15. #15
    Registered User
    Join Date
    10-04-2010
    Location
    south africa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: vba compare arrays and remove exact matching arrays

    Quote Originally Posted by jindon View Post
    See if the attached works.
    Hi

    Ok it worked once...now on trying it with actual data it seems to not work

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: vba compare arrays and remove exact matching arrays

    Bad luck and no idea about the file that I don't see.

+ 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. [SOLVED] New to arrays-where do I find a good beginners guide to multi dimensional arrays
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-04-2013, 07:44 PM
  2. Matching value in two arrays
    By wondering2 in forum Excel General
    Replies: 2
    Last Post: 12-26-2010, 09:58 PM
  3. Compare 2 Arrays
    By Antnee in forum Excel General
    Replies: 8
    Last Post: 12-22-2009, 08:24 AM
  4. [SOLVED] Arrays - declaration, adding values to arrays and calculation
    By Maxi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2006, 11:15 AM
  5. [SOLVED] OR EXACT Formula Appears to not accept Arrays
    By JennyJeneralGraves in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-02-2006, 03:25 PM

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