Google Sheets - SUMIF, COUNTIF, AVERAGEIF Functions

Sdílet
Vložit
  • čas přidán 24. 05. 2024
  • As you might now you can use the SUM, COUNT & AVERAGE functions to find out the sum, size and average of a dataset. You might also know that you can use the IF function to setup a basic IF-THEN statement.
    But did you know that you can combine these to only add, count or average datapoints in a dataset that fulfil specific criteria? The functions are written as SUMIF, COUNTIF and AVERAGEIF and all work very similar. For simplicity, let’s actually start with COUNTIF.
    For the COUNTIF function you simply choose the range you are interested in and then establish the criteria that datapoints in the range have to fulfil in order to be counted. Just remember to put quotation marks around the criteria!
    The SUMIF and AVERAGEIF functions work exactly the same, first you choose the CRITERIA RANGE, meaning the RANGE YOU WANT TO TEST whether or not the function should be performed. Then you add the CRITERIA, which if TRUE causes the function to use the corresponding cell in the sum or average range. Again, remember quotation marks around the criteria!
    Let’s demonstrate all 3 of these with an example!
    Here you have all the Pokémon from Gen 1 along with their stats. Now, I want to find out which type has the highest average total stats. I can do so by either adding all the stats from each type, using the SUMIF function, then counting the amount of Pokémon of each type, using the COUNTIF function, and finally dividing the two. Alternatively, I can just use the AVERAGEIF function to achieve the exact same thing.
    In either case, first choose the range where to check if our criteria is TRUE, then set up that criteria (in this case the type of interest is written within quotations and an asterisk on each side to account for Pokémon with more than one type. Finally, in the case of SUMIF and AVERAGEIF, the range we want to use those functions on is specified.

Komentáře •