Help with Array compare

  • Thread starter Thread starter GMet
  • Start date Start date
G

GMet

I have 2 arrays from which I want to create a 3d. I need to compare the
TotArray with the UsedArray and put the difference into AvailableArray. For
example

TotArray
Ford
Chevy
Datsun
Nisan
Toyota

UsedArray
Ford
Chevy
Datsun

AvailableArray
Nisan
Toyota

I can't seem to get the
 
This might work..

dim x as integer
dim Add as boolean
dim availarray(1)
x = 1
for i = 1 to ubound(totarray)
add = true
for j = 1 to ubound(usedarray)
if totarray(i) = usedarray(j) then
Add = false
next j
if add = true then
redim availarray(x)
availarray(x) = totarray(i)
x = x + 1
end if
next i
 
Will UsedArray always be the same up to a point as TotArray? As in, wil
the difference always be because one is longer than the other?

Do you only want to compare the items with the same index number or d
you want to know if the value is matched anywhere at all in the othe
array?

Are the arrays organized in some useful way?

Is it possiblethat you would have dupliate entries in one array and i
so, assuming the value is found only once in the other array, shoul
the value be added to your new array?

Would I be correct in assuming that the UsedArray only contains value
from the TotArray?

Thanks - piku
 
The UsedArray is always a subset of the TotArray
The difference between TotArray and UsedArray will always go into AvailArray
There are never duplicates in any of the arrays
The TotArray is organized by number in ascending order
( the original example shows cars, but the actual data is a text field
of numbers) - never more than 8
TotArray
411310
411320
411330
411340
411350
411360

The items in the UsedArray may not be contiguous - for example
UsedArray
411320
411340
411360

GMet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top