Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7522217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:27:31+00:00 2026-05-30T02:27:31+00:00

I got 2 expandable arrays with strings in them and I want to compare

  • 0

I got 2 expandable arrays with strings in them and I want to compare both with each other to see which includes strings that the other dont.

lets say my arrays are like:

ARRAY - 1       ARRAY - 2
   a1               a1
   a2               a2
   a3               a3
   a9               a4
   a10              a8
   a11              a10
   a12              a11

i wanna get the result as:

ARRAY - 4       ARRAY - 5       ARRAY - 6
   a9               a4             a1
   a12              a8             a2
                                   a3
                                   a10
                                   a11

another 3 different array should give me the difference of array1 when compared to array 2

-array4 here gives the strings that is included in array1 but not found in array2
-array5 here gives the strings that is included in array2 but not found in array1
-array6 here gives the strings that is found in both

for this i ve coded:

i = 0
j = 0

For Each innerElement1 In CompareElement1 'CompareElement1 is the array1 here

    NoneFound = 1

    'Ones thats in first element also found in second element..
    For Each innerElement2 In CompareElement2 'CompareElement2 is the array2 here

        If innerElement1 = innerElement2 Then

            'Expand array
            ReDim Preserve IncludedInBoth(0 To UBound(IncludedInBoth) + 1)
            IncludedInBoth(i) = innerElement1
            'Item found in both so NoneFound is 0.
            NoneFound = 0
            i = i + 1

        End If

    Next

    'Ones thats in first element but not found in second element..
    If NoneFound = 1 Then

        'Expand array
        ReDim Preserve NotIncludedInElem2(0 To UBound(NotIncludedInElem2) + 1)
        NotIncludedInElem2(j) = innerElement1
        j = j + 1

    End If

Next

'Seperate Comparison for the ones that found in second element _
 but not found in first element..
i = 0

For Each innerElement1 In CompareElement2

    NoneFound = 1

    'Ones thats in second element also found in first element.
    For Each innerElement2 In IncludedInBoth

        If innerElement1 = innerElement2 Then

            'Item found in both so NoneFound is 0.
            NoneFound = 0

        End If

    Next

    'Ones thats in second element but not found in first element..
    If NoneFound = 1 Then

        'Expand array
        ReDim Preserve NotIncludedInElem1(0 To UBound(NotIncludedInElem1) + 1)
        NotIncludedInElem1(i) = innerElement1
        i = i + 1

    End If

Next

my code up there exactly does the comparing and giving the true answer but with a lack of performance caused by inner for each calls is there a way to do this comparing with a faster way? its taking like forever to finish this comparing..

also a little note:

array1 and array2 are two different sized arrays that contains thousands(~100.000)of strings in each.
also they are not in order. i would like to learn how to order them alphabetically.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:27:33+00:00Added an answer on May 30, 2026 at 2:27 am

    with that amount of data, create a database, load to tables and use SQL. It will run too slow trying to do it manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

got some problems. Built an applet that has to be used step-by-step. After each
I've got an expandable css menu that is acting a bit weird in ie,
Got a seg fault from my memcpy that gdb can't give me anything else
Got datatable with Id, parentId, description. It is a relationial table structure. I want
I'm using Unobtrusive Toggling in a view that contains many records (Orders). I've got
I think this question is quite common. Recently I have got a requirement that
Got a issue with Facebook Graph API. I want to read page notifications via
Got into confusion I have to do book shelf for tablet. Which holds books
Got this: http://jsfiddle.net/NdsF8/ Want it to be dynamic so when you click a new
Got a grid with some numeric columns and it's need to implement for each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.