+ Reply to Thread
Results 1 to 15 of 15

List differences between two arrays

  1. #1
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    List differences between two arrays

    I have two columns, column A and column B. All column B values are contained in column A, but not all column A values exist in column B. I want to list the differences in say, column C. Also the values may be repeating.

    Lets say my column A values are: A, A, A, B, B, B, C, C, D, D, D, E

    column B values are: A, B, D

    column C values would then be: C, E

    How do I create a macro or formula to produce column C?

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

    Re: List differences between two arrays

    Assuming data starts from A1
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    Re: List differences between two arrays

    I think I need some more help to adjust your code for my workbook.

    Let's assume "Column A" is located on a sheet named "DATA", the the actual data starts in cell B2, now let's assume "Column B" is located on a sheet named "CODES", and the actual data starts in cell D2. Now also lets assume I want the newly identified values to be placed starting on cell P2 on that "CODES" sheet.

    Is this doable?

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

    Re: List differences between two arrays

    Upload a workbook showing exactly what you have and the result you expect.

  5. #5
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    Re: List differences between two arrays

    The "manual" flow of this task is to take the unique values of column B on sheet DATA, from them take out the values of column B on sheet CODES, and place the difference in column P of sheet CODES. Duplicate values will almost always exists on column B on sheet DATA, but the values on sheet CODES will always be unique.

    Does this make sense?

    Thank you.

  6. #6
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    Re: List differences between two arrays

    Attachment
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-28-2013
    Location
    Lima Peru
    MS-Off Ver
    Excel 2013
    Posts
    69

    Re: List differences between two arrays

    Hi lostest!. Try this in the file you have just uploaded, and please tell me if it works in your PC or not
    Please Login or Register  to view this content.
    Last edited by EduardoHiguchi; 03-09-2016 at 02:13 PM.

  8. #8
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    Re: List differences between two arrays

    Eduardo that works pretty good.

    Since I can't quite grasp your code completely I just want to note two things.

    The amount of data on the DATA sheet is over 20,000 - meaning I have over 20,000 rows. The amount of data on the CODES sheet, column B is into the several hundreds. To fix this I just changed your "B100" to "B100000".

    Also column P on sheet CODES should be completely cleared each time the code is run, otherwise any changes made to the columns B data will NOT show up, assuming said data is NOT overwritten by the possible new differences.

    To fix this I just inserted...

    Please Login or Register  to view this content.
    ...at the beginning of your code.

    Is my code an efficient way to handle these two points?

  9. #9
    Registered User
    Join Date
    11-28-2013
    Location
    Lima Peru
    MS-Off Ver
    Excel 2013
    Posts
    69

    Re: List differences between two arrays

    ----------------------------------------------------------
    Last edited by EduardoHiguchi; 03-09-2016 at 11:55 AM.

  10. #10
    Registered User
    Join Date
    11-28-2013
    Location
    Lima Peru
    MS-Off Ver
    Excel 2013
    Posts
    69

    Re: List differences between two arrays

    Yes, the modifications you have done are OK! However, i would not put this code at the beginning of the code
    Please Login or Register  to view this content.
    i would put it just after the following code
    Please Login or Register  to view this content.
    that already exists in the middle of the code i submitted you. I want to ask you a favour, could you please mark this thread as solved?
    Additionally also if you think that i helped you solve the thread please kindly "pay me" by adding reputation to my post. Have a nice day!
    Last edited by EduardoHiguchi; 03-09-2016 at 11:56 AM.

  11. #11
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    Re: List differences between two arrays

    Absolutely. Thank you very much.

    Your help will save me a lot of time, and even more frustration.

  12. #12
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    Re: List differences between two arrays

    One last thing,

    If all the unique values in column B sheet DATA are contained in column B sheet CODES, and there are no values to be placed in column P a run time error pops up.

    Specifically this codes is highlighted,
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    11-28-2013
    Location
    Lima Peru
    MS-Off Ver
    Excel 2013
    Posts
    69

    Re: List differences between two arrays

    Modify the last part of the code with the following:
    Please Login or Register  to view this content.

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

    Re: List differences between two arrays

    Try one of 2
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    10-10-2015
    Location
    the Dysfunctional Empire of Bulgaria
    MS-Off Ver
    2010
    Posts
    102

    Re: List differences between two arrays

    Thanks Jindon.

+ 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: 6
    Last Post: 02-05-2016, 12:35 PM
  2. [SOLVED] Show differences in List 1 compared to List 2.
    By PeterHOz in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-11-2014, 05:40 AM
  3. Signalling differences between 2 arrays
    By tays01s in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-24-2013, 07:42 AM
  4. [SOLVED] Compare Price List for differences.
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-18-2012, 11:15 AM
  5. Looking for differences in a list of similar products
    By kosciosco in forum Excel General
    Replies: 2
    Last Post: 04-19-2011, 04:46 AM
  6. List differences
    By sparx in forum Excel General
    Replies: 11
    Last Post: 04-17-2006, 06:50 AM
  7. List Differences
    By sparx in forum Excel General
    Replies: 2
    Last Post: 04-12-2006, 05:23 AM

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