Results 1 to 3 of 3

Thread: Comparing one fixed size array to one dynamic array

  1. #1
    Neophyte consumer48's Avatar
    Join Date
    Oct 2015
    Location
    Romania
    Posts
    2
    Articles
    0

    Comparing one fixed size array to one dynamic array



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello. I'm have a project that requires me to compare a fixed length array:

    Code:
    dim fArray(3) as variant
       fArray(0)=0
       fArray(1)=50
       fArray(2)=100
       fArray(3)=150
    , to a dynamic array like this one:

    Code:
    dynArray(0)=0
    dynArray(1)=100
    dynArray(2)=150
    dynArray(3)=200
    dynArray(4)=250
    dynArray(5)=300
    dynArray(6)=350
    .

    The thing is though, i want to compare each element of the first array with every element of the second array, and if i get a match do something, and delete the matched elements from the second array. Then, again, compare them, see that there are no matches, calculate the difference between the first element of the first array and the first element of the second array, and add it to all of the elements of array 1, therefore equalizing them so that they can be deleted once more. And so on... i'm gonna do an example below, because i don't know if i made any sense.

    A1=(0,50,100,150)
    A2=(0,100,150,200,250,300,350)
    after comparison, 0=0, 100=100, and 150=150 => do something, then recreate the elements:
    A1=(0,50,100,150)
    A2=(200,250,300,350)
    compare them again, there are no matches, so add 200(elem1-elem1 of each array) to the first array=>
    A1=(200,250,300,350)
    A2=(200,250,300,350)
    now that i have a match, all element can be deleted, so the second array will be emptied . Basically, the first array empties the second one step by step, by equalizing the elements.

    I'm sorry for the long post, but it's the only way i could have explained what i need. I really hope you guys can help me. Thank you!

  2. #2
    Conjurer snb's Avatar
    Join Date
    May 2013
    Posts
    375
    Articles
    0
    Excel Version
    2020
    You can empty all elementes of the second array in steps, but why not in 1 go ?
    You should elaborate on the advantages to do this in steps.

  3. #3
    Neophyte consumer48's Avatar
    Join Date
    Oct 2015
    Location
    Romania
    Posts
    2
    Articles
    0
    Because the program has to do something, export some data between those steps, so i need to do it sequentially. I need to export to a notepad the deleted elements, and the value of each addition done to the first array.
    Last edited by consumer48; 2015-10-09 at 05:18 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •