Search code examples
arrayssumgoogle-sheets-formulaarray-formulasgoogle-query-language

Filtering Values Produced by an ARRAYFORMULA


I am using an ARRAYFORMULA to extract unique values from a list of names and total up a second column for each of those names.

Here is some example data and the ARRAYFORMULA I am using

Example Data

ARRAYFORMULA in cell E3

=ARRAYFORMULA({{unique(B3:B11)},{sumif(B3:B11, (unique(B3:B11)),C3:C11)}})

What I would like to do is filter out those names where the total number of tokens is zero - i.e. I would like Peter to be filtered out of the list because he has a net total of zero Tokens.

[I'd also like to have Peter, and any others, displayed in a separate list, but I guess if you can help me crack this first part I can help myself crack the second part]

Is there a way I can achieve what I want with a single ARRAYFORMULA? Is there another (better) way to achieve the same result?

I've bashed my head against this for a while so would be grateful for any help


Solution

  • use:

    =QUERY(QUERY({B3:C}; 
     "select Col1,sum(Col2) 
      where Col1 is not null 
      group by Col1 
      label sum(Col1)''"); 
     "where Col2 is not null"; )