Question

I have one array

1 
2
3

another array

4
5
6

How do I use one function to join the 2 arrays?

1
2
3
4
5
6
Was it helpful?

Solution

Let's say your arrays are:

A1:A3 = {1;2;3} and B1:B3 = {4;5;6}

Write somewhere: ={A1:A3;B1:B3}

Semicolons ; are used to separate rows, and commas , are for columns.

Here is the documentation: Using arrays in Google Sheets

OTHER TIPS

TRANSPOSE() //takes matrix as argument and returns transposed matrix
SPLIT() //breaks apart a string based on a delimiter character (char(13) here)
ARRAYFORMULA() //applies the formula within to array vs cell
CONCATENATE() //joins each cell in each range with a char(13), then the next cell...then the next matrix of cells (to which the first process also happens)
//note char(13) is a carriage return, i will call CR for ease

so if you have matrix A : 1, 2, 3 and matrix B : 4, 5, 6

the steps would look like this:

TRANSPOSE(SPLIT(ARRAYFORMULA(CONCATENATE("1CR2CR3CR" ; "4CR5CR6CR")), CR))
TRANSPOSE(SPLIT("1CR2CR3CR4CR5CR6CR", "CR"))
TRANSPOSE({"1","2","3","4","5","6"})

finally:

1
2
3
4
5
6

=FLATTEN(A1:A3,B1:B3) should do the trick

screenshot

=filter({A1:A;B1:B}, {A1:A;B1:B}<>"")

Given the information provided by Mr.Monshaw, I figured this out for you.

Given values "1,2,3" are in cells A1:A3 of a spreadsheet, and values "4,5,6,7" are in cells B1:B4. Here is the formula to use:

=TRANSPOSE(SPLIT(ARRAYFORMULA(CONCATENATE(concat(A1:A3,",");concat(B1:B4,","))),","))

Explanation. The concat formula creates a string of the values with the indicated separator, ",". So concat(A1:A3,",") results in "1,2,3".

The Concatenate combines the values of the specified array as one string. So CONCATENATE(concat(A1:A3,",");concat(B1:B4,",")) results in "1,2,3,4,5,6,7"

The Split function here is used to identify the "," as a deliminator and not a value in the array. The Transpose will cause the results to display in a column instead of in a row.

I'm noticing this is an older question, so this might not have existed when previous responses were written.

You're looking for the JOIN() formula.

(Documentation link)

Sample Usage

JOIN(" and-a ",{1,2,"1 2 3 4"})

JOIN(",",{1,2,3},{4;5;6})

JOIN("-",A1:A100)

Syntax

JOIN(delimiter, value_or_array1, [value_or_array2, ...])

delimiter - The character or string to place between each concatenated value.

delimiter may be specified as blank, e.g. JOIN(,{1,2,3}). value_or_array1 - The value or values to be appended using delimiter.

value_or_array2, ... - [ OPTIONAL ] - Additional value or array to be appended using delimiter.

I found this even easier...

=ARRAYFORMULA({A:A;B:B})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top