PDA

View Full Version : Combining data of Two Array or Range



princ_wns
04-04-2012, 06:05 PM
Hi All,

Today i came across a problem i have to combine data of two array into a new array can any one plaese help me i doing this .
if this is not possible the is there any way to combine two range of data into single one.




thanks in advance:)

Rick Rothstein
04-04-2012, 07:02 PM
Can you provide us with some more details please. What kind of arrays are you talking about... VBA coded arrays or cell ranges? Do these arrays have one or two dimensions? Exactly how did you want the elements of the arrays combined? Providing us with a small example showing what each array contains before processing and what the resulting array should look like afterwards would help us out tremendously.

princ_wns
04-05-2012, 07:50 AM
thanks for quick reply.

this is a 2D array of VBA which holds the data of two ranges.And I want this data to be displayed as in example:
arr1= 1 2 3
2 3 4
arr2= q q r
s t u
resArr=1 2 3
2 3 4
p q r
s t u

Rick Rothstein
04-05-2012, 08:44 AM
thanks for quick reply.

this is a 2D array of VBA which holds the data of two ranges.And I want this data to be displayed as in example:
arr1= 1 2 3
2 3 4
arr2= q q r
s t u
resArr=1 2 3
2 3 4
p q r
s t u
This is not a trivial thing to do; however, here is a website that includes code to do it...

VBA Arrays (http://www.cpearson.com/excel/VBAArrays.htm)

There is a description of how to use the code in a section titled "CombineTwoDArrays". To go directly to the code, search the webpage for this text string...

Public Function CombineTwoDArrays

princ_wns
04-05-2012, 04:09 PM
Thanks Rick for your quick reply.

MarkoLimbek
10-01-2012, 06:52 PM
Can you provide us with some more details please. What kind of arrays are you talking about...

Hi, I have another interesting example.

I have two or more columns that I would like to combine to matrix. I have tried solutions like =(c_1:c_2) and =CHOOSE({1;2};TRANSPOSE(c_1;TRANSPOSE(c_2)), but they work only for ordinary cell values or easy formulas like =ROW(2:5)-ROW(1:4) (that creates ones).
My columns are complicated formulas like

=IFERROR(INDEX(ROW(3:10)-ROW(3:10); ROWS(C$1:$C3)); IFERROR(INDEX(ROW(4:5)-ROW(3:4); ROWS(C$1:$C3)-ROWS(ROW(3:10)-ROW(3:10))); "")).

This is a complicated formula for a single cell.
How could I combine two such columns into matrix?
I would be the happiest if Excel would come out with some simple formula like JOIN.

Thank you
Marko