How to stick two arrays together in google sheets or excel?
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:
=FILTER(A2:B4,C2:C4)
=FILTER(A2:B4,D2:D4)
=ARRAYFORMULA(GLUE(FILTER(A2:B4,C2:C4),FILTER(A2:B4,D2:D4)))
A 30
B 31
A 30
C 32
1 Answer
1
You can use A1:C3;A4:C5
to glue them vertically. Use ,
or to glue them horizontally¹. Unlike google-spreadsheet, excel however only supports glueing numbers/string literals and doesn't support cell references.
A1:C3;A4:C5
,
@user250
filter
out the blanks.– I'-'I
7 hours ago
filter
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The problem I have with this is that if one of the matrices is empty, it adds an empty row.
– user2506946
16 hours ago