Conteúdo do Curso
Google Spreadsheets
Google Spreadsheets
SUMIFS, COUNTIFS and AVERAGEIFS
In this chapter we will explore the SUMIFS, COUNTIFS, and AVERAGEIFS functions. These functions are designed to perform calculations based on multiple specified conditions. They enable you to process large datasets by focusing on values that meet several criteria.
SUMIFS Function
The SUMIFS function sums values in a range that meet multiple specified conditions.
Syntax
SUMIFS(sum_range, criteria_range1, criterion1, criteria_range2,criterion2,...criteria\_range2, criterion2, ...)
- sum_range – The range to sum;
- criteria_range1 – The range to test against criterion1;
- criterion1 – The condition applied to criteria_range1;
- criteria_range2, criterion2, ... – OPTIONAL – Additional ranges and conditions to test.
COUNTIFS Function
The COUNTIFS function counts the number of cells in a range that meet multiple specified conditions.
Syntax
COUNTIFS(criteria_range1, criterion1, criteria_range2,criterion2,...criteria\_range2, criterion2, ...)
- criteria_range1 – The range to test against criterion1;
- criterion1 – The condition applied to criteria_range1;
- criteria_range2, criterion2, ... – OPTIONAL – Additional ranges and conditions to test.
AVERAGEIFS Function
The AVERAGEIFS function calculates the average of values in a range that meet multiple specified conditions.
Syntax
AVERAGEIFS(average_range, criteria_range1, criterion1, criteria_range2,criterion2,...criteria\_range2, criterion2, ...)
- average_range – The range to average;
- criteria_range1 – The range to test against criterion1;
- criterion1 – The condition applied to criteria_range1;
- criteria_range2, criterion2, ... – OPTIONAL – Additional ranges and conditions to test.
Examples for SUMIFS, COUNTIFS, and AVERAGEIFS
Value (A) | Value (B) | Value (C) | Formula | Result | Comment | |
---|---|---|---|---|---|---|
Green | 130 | 2023-04-22 | SUMIF(A2:A14, "Green", B2:B14) | 560 | Sums values from column B where column A equals "Green." Total 6 values: 130 + 60 + 90 + 110 + 95 + 75. | |
Red | 150 | 2022-10-15 | SUMIFS(B2:B14, A2:A14, "Red", B2:B14, ">90") | 250 | Sums values from column B where column A equals "Red" and column B values are greater than 90. Matches 2 values: 150 + 100. | |
Blue | 120 | 2024-02-09 | SUMIFS(B2:B14, C2:C14, ">=2023-01-01", C2:C14, "<=2023-12-31") | 460 | Sums values from column B where dates in column C are in 2023. Matches values: 130, 150, 120, 60, 90. | |
Green | 60 | 2022-06-17 | COUNTIF(A2:A14, "Green") | 6 | Counts cells in column A equal to "Green." Total 6 matches. | |
Green | 90 | 2023-11-05 | COUNTIFS(A2:A14, "Red", B2:B14, ">80") | 2 | Counts cells where column A equals "Red" and column B values are greater than 80. Matches 2 values: 150 and 100. | |
Red | 75 | 2024-01-28 | COUNTIFS(C2:C14, ">=2023-01-01", C2:C14, "<=2023-12-31") | 4 | Counts cells in column C with dates in 2023. Matches 4 values. | |
Red | 85 | 2022-08-03 | AVERAGEIFS(B2:B14, A2:A14, "Green") | 93.33 | Calculates the average of column B values where column A equals "Green." (130 + 60 + 90 + 110 + 95 + 75)/6 = 93.33. | |
Green | 110 | 2024-05-12 | AVERAGEIFS(B2:B14, A2:A14, "Red", B2:B14, ">90") | 125 | Calculates the average of column B values for "Red" where values are greater than 90. Average of 100 and 150. | |
Green | 95 | 2023-12-21 | AVERAGEIFS(B2:B14, C2:C14, ">=2023-01-01", C2:C14, "<=2023-12-31") | 115 | Calculates the average of column B values for rows with dates in 2023. Average of 130, 150, 120, 60, 90. | |
Blue | 145 | 2023-07-04 | ||||
Red | 100 | 2024-03-17 | ||||
Green | 75 | 2024-06-30 | ||||
Red | 90 | 2022-12-11 |
Obrigado pelo seu feedback!