Range not changing when using a QUERY inside an ARRAYFORMULA

67 Views Asked by At

I have a large set of data stored in a spreadsheet and wish to extract some information from it.

Basically, I have 2 columns, Email and Reference. I used the following sample for my tests :

Email               Reference
-----------------------------
[email protected]    REF-0001
[email protected]    REF-0002
[email protected]    REF-0003
[email protected]    REF-0004
[email protected]    REF-0005
[email protected]    REF-0006
[email protected]    REF-0007
[email protected]    REF-0008
[email protected]    REF-0009

For each individual email, I want to list the references, as follow :

Email               References
-------------------------------------
[email protected]    REF-0001
[email protected]    REF-0002,REF-0003
[email protected]    REF-0004
[email protected]    REF-0005
[email protected]    REF-0006,REF-0007
[email protected]    REF-0008,REF-0009

I used the following formula to generate my Reference column in the results : JOIN(","; UNIQUE(QUERY($A$3:$B; "select B where A='"&$D13&"'"))), where $D13 is the corresponding email address. This works perfectly fine when Drag&Dropping this formula into other cells.

However, when I try to use the following formula : ARRAYFORMULA(IF(ISBLANK(D13:D);;JOIN(","; UNIQUE(QUERY($A$3:$B; "select B where A='"&D13:D&"'"))))), only the value for D13 gets copied on all the cells of the range.

Why is taht ? Why is D13 considered a fixed value whereas the formula still expands ?

As I realize my question is a bit long, you can find the sample I used in the following link:

LINK TO THE SPREADSHEET SAMPLE

1

There are 1 best solutions below

0
On

Not all Sheet functions can be used within an arrayformula, and my understanding is that neither QUERY nor UNIQUE will work in this way.