SUMIFS function in Google Spreadsheet

后端 未结 4 588
忘掉有多难
忘掉有多难 2020-11-30 06:42

I\'m trying to have a similar function to SUMIFS (like SUMIF but with more than a single criterion) in a Google Spreadshe

相关标签:
4条回答
  • 2020-11-30 07:10

    This guy used the Filter function to chop down the array by the criteria, then the sum function to add it all in the same cell. http://www.youtube.com/watch?v=Q4j3uSqet14 It worked like a charm for me.

    0 讨论(0)
  • 2020-11-30 07:15

    As of December, 2013, Google Sheets now has a SUMIFS function, as mentioned in this blog post and documented here.

    Note that old spreadsheets are not converted to the new version, though you can try copy-pasting the data into a new workbook.

    0 讨论(0)
  • 2020-11-30 07:32

    I found a faster function to fill up the "pivot table":

    =ARRAYFORMULA(SUM(((Sample!$A:$A)=$A2) * ((Sample!$B:$B)=B$1) * (Sample!$C:$C) ))
    

    It seems to run much faster without the heavier String and Query functions.

    0 讨论(0)
  • 2020-11-30 07:33

    The simplest way to easily make SumIFS-like functions in my opinion is to combine the FILTER and SUM function.

    SUM(FILTER(sourceArray, arrayCondition_1, arrayCondition_2, ..., arrayCondition_30))
    

    For example:

    SUM(FILTER(A1:A10;A1:A10>5;B1:B10=1)
    

    Explanation: the FILTER() filters the rows in A1:A10 where A1:A10 > 5 and B1:B10 = 1. Then SUM() sums the values of those cells.

    This approach is very flexible and easily allows for making COUNTIFS() functions for example as well (just use COUNT() instead of SUM()).

    0 讨论(0)
提交回复
热议问题