View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Can I do this with arrays?

It would only clear or null the value, it would not change the dimension of
the array. After you clear all the values, you would need to loop through
the array and move the values to be contiguous, then redim preserve the
array to reduce its size.

--
Regards,
Tom Ogilvy

"Ed" wrote in message
...
I'd like to compare one array to another and remove any values from the
first that are the same as values in the second. So if the first array is
(12), (13), (14), (21), (22), (23),
and the second is (12), (13), (14),
is there an array formula that would reduce the first array to (21), (22),
(23).

If not, I suppose I can simply iterate through the second and grab a

value,
then iterate through the first and delete any matching value.

Of course, this would require a ReDim on the first array, right? And to

do
that, I would need to know how many values I now have in the first array,
right? But did the action of the deleting actually remove the data
positions from the first array and change the UBound from 6 to 3, or did

it
just fill those data positions with 0 or null? So after the deletion, is

my
first array really (21), (22), (23)? Or is it (), (), (), (21), (22),
(23)? If the latter, how do I remove the nulls?

Any help is greatly appreciated.
Ed