View Single Post
  #19   Report Post  
Posted to microsoft.public.excel.programming
Stratuser Stratuser is offline
external usenet poster
 
Posts: 63
Default Append One Array to Another, and Consolidate

The fifth element is the monthly return of the stock with ticker "A", which
is the same in both cases, so it would still be 7 in the consolidated array.

"Alan Beban" wrote:

Well, I guess that gets us closer, but not quite there. Suppose then
that the first row of array1 were

A Tech 0 5 7

or the first row of array2 were

A Tech 4 0 7

What is the value of resultingArray(1,5)? 7? 9? Something else? How is
it determined?

Alan

Stratuser wrote:
The third column of the first array will be empty in every case, and the
fourth column of the second array will be empty in every case, so the example
you have won't occur.

"Alan Beban" wrote:

Stratuser wrote:
The duplicate elements I was referring to would occur in the first column.
If there were two elements in the first column with the same value (ticker
symbols in my case) as a result of appending the two arrays, I would
substitute any positive values in the columns to the right for blank or zero
values for the same ticker symbol. To illustrate, here's an example of two
arrays, 2x5 and 3x5:

array1:

A Tech 0 5 9
B Energy 0 6 4

array 2:

A Tech 4 0 9
K Materials 6 0 8
L Utilities 7 0 3

The two arrays would consolidate like so, because ticker A is in both arrays:

A Tech 4 5 9
B Energy 0 6 4
K Materials 6 0 8
L Utilities 7 0 3

I'm still not quite getting the algorithm. Suppose everything were as
above except that the first row of array1 were

A Tech 3 5 7

what would be the value for resultingArray(1,3) and resultingArray(1,5)?

Alan Beban