I am trying to query a list of sales stored in Excel using a dynamic array formula referencing a spill range and this does not work.
Here is the context:
tabSales containing the sales, with the following data : date, customer, amount, year (calculated using =YEAR([Date])SelCust)Here is what I have tried on the report sheet:
=UNIQUE(FILTER(tabSales[Year],tabSales[Customer]=SelCust)) (formula input in cell D2)=SUM(FILTER(tabSales[Amount],(tabSales[Year]=D2#)*(tabSales[Customer]=SelCust))) (formula input in E2)Unfortunately, this last formula unfortunately does not work:
The lack of spilling makes me wonder whether the spill range reference within the FILTER function is recognized...
How could I get this formula to work ?
Use SUMIFS():
=SUMIFS(tabSales[Amount],tabSales[Year],D2#,tabSales[Customer],SelCust)
This should return an array properly.
If one wants to do both columns in one dynamic formula we can use LET and CHOOSE:
=let(
slcust,tabSales[Customer],
amt,tabSales[Amount],
yr,tabSales[Year],
unYr,UNIQUE(FILTER(yr,slcust=SelCust)),
sm,SUMIFS(amt,yr,unyr,slcust,SelCust),
Choose({1,2},unyr,sm))