user2506946
user2506946

Reputation: 171

How to stick two arrays together in google sheets or excel?

Imagine I have two matrices. A:

a 1
b 2
c 3

and B:

d 4
e 5

I want a function say "GLUE" to stick them together. I want something like

=ARRAYFORMULA(GLUE(A,B))

Which produces:

a 1
b 2
c 3
d 4
e 5

These two matrices are produced dynamically (by a formula) and are nowhere in the sheet, so I need a "dynamic way" to glue them together.


Here is a concrete example. Suppose we have the following table:

Name  AGE     User      Developer
A      30     True      True
B      31     True      False
C      32     False     True

I need a list of users and developers that duplicate those that are both. So I can get the users with =FILTER(A2:B4,C2:C4) and the developers with =FILTER(A2:B4,D2:D4). So ideally I could use =ARRAYFORMULA(GLUE(FILTER(A2:B4,C2:C4),FILTER(A2:B4,D2:D4))) (where GLUE is the function I need!) producing:

A      30
B      31
A      30
C      32

Upvotes: 0

Views: 840

Answers (1)

TheMaster
TheMaster

Reputation: 50426

You can use {A1:C3;A4:C5} to glue them vertically. Use , or \ to glue them horizontally¹. Unlike , however only supports glueing numbers/string literals and doesn't support cell references.

Upvotes: 1

Related Questions