I am trying to query a list of sales stored in Excel by using TEXTJOIN and FILTER and referencing a spill range and this does not work.
Here is the context:
I have a table
tabSales
containing the sales, with the following data : date, customer, amount, year (calculated using=YEAR([Date]
)I want to display on a report sheet for every year the list of customers who were sold something during the year as a merged text (e.g. 2020 ⇨ "John Smith, Alan Dulles")
Here is what I have tried on the report sheet:
I have used the
SORT
andUNIQUE
functions to make the report display on column D the list of years where some sales occurred :=SORT(UNIQUE(tabSales[Year]), , -1)
(formula input in cell A2)I have then tried to use the
JOINTEXT
andFILTER
functions and Excel's spill range feature to display for each year the list of all customers who were sold something during that year :=JOINTEXT(",", TRUE, FILTER(tabSales[Customer],tabSales[Year]=A2#))
(formula input in B2)
Unfortunately, this last formula does not work:
- Excel returns #N/A in B2
- B2 does not spill over B3, B4, ...
The lack of spilling makes me wonder whether the # reference within the FILTER
function is recognized...
How could I get this formula to work ?