+ Reply to Thread
Results 1 to 9 of 9

Comparing arrays

  1. #1
    Registered User
    Join Date
    11-21-2006
    Posts
    73

    Comparing arrays

    Is there any way to compare the contents of two arrays?

    This is to verify data entry... in certain cases records will be double keyed to check for accuracy. I would like a quick easy way to check the similarity of two sets of data.

    For instance, in the example below i would like a formula that returns "true" since the data is exactly the same.

    Record1 4 5 6 4 1
    Record1 4 5 6 4 1


    Is there anyway to do this?

    Thanks!

  2. #2
    Registered User
    Join Date
    11-21-2006
    Posts
    73

    Re: Comparing arrays

    Nevermind, I found what I was looking for.

    =SUM(IF(B1:P1=B2:P2,0,1))

    Thanks.

  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: Comparing arrays

    One really brute force way to check... of those cells are A1:F1 and A2:F2, then in another cell:

    =(A1&"-"&B1&"-"&C1&"-"&D1&"-"&E1&"-"&F1) = (A2&"-"&B2&"-"&C2&"-"&D2&"-"&E2&"-"&F2)
    _________________
    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
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Comparing arrays

    =and(a1:f1=a2:f2), array-entered.
    Entia non sunt multiplicanda sine necessitate

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

    Re: Comparing arrays

    Quote Originally Posted by shg View Post
    =and(a1:f1=a2:f2), array-entered.
    Ooh, I was hoping! But I can't get that to work.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Comparing arrays

    Array formula, JB.

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

    Re: Comparing arrays

    Yeah, I saw that. tried it both ways, of course, #VALUE error both times.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Comparing arrays

    Post an example that doesn't work, JB.

  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: Comparing arrays

    (*blush*) went to post it, same exact sheet...now it's working. *sigh*

    I'm glad though. I have many uses for that new nugget. Thanks.

+ 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