How to use sumif function? -How to use the sumif function

Time: 2024-05-22source:author:

1. Basic grammar:

SUMIF(range, criteria, [sum_range])

Parameter explanation:

Range: A required parameter, indicating the range of cells to be judged.

Criteria: Required parameters, indicating the conditions to be judged, which can be numbers, text, logical values ​​or expressions.

​ ​ ​ ​ sum_range: Optional parameter, indicating the range of cells to be summed. If omitted, the function will sum the cells within the range based on the condition

2. How to use:

Determine a single condition: For example, to sum all cells with the value "Apple" in the range A1:A10, you can use =SUMIF(A1:A10, "Apple").

Determine multiple conditions: If you want to satisfy multiple conditions at the same time, you can use the AND function to combine multiple conditions. For example, to sum all cells in the range A1:A10 with a value of "Apple" and a cell color of green, you would use =SUMIF(A1:A10, "Apple", B2:B10).

Determine non-empty cells: If you want to determine whether a cell is empty, you can use the "*" symbol. For example, to sum the values ​​of all non-empty cells in the range A1:A10, you can use =SUMIF(A1:A10, "*", B2:B10).

Use wildcards: You can use the "*" symbol for fuzzy matching to represent any sequence of characters; use the "?" symbol to represent any single character. For example, to sum the values ​​of all cells starting with "ABC" and ending with "XYZ" in the range A1:A10, you can use =SUMIF(A1:A10, "ABC*XYZ", B2:B10).

Ignore null values: If you want to ignore null values, you can use the "<>" symbol in the formula. For example, to sum the values ​​of all cells that are not equal to null in the range A1:A10, you can use =SUMIF(A1:A10, "<>""", B2:B10).

3. Example:

Calculate annual sales: Assume that the year is in column A and the sales are in column C. You can use =SUMIF(A2:A10, "2017", C2:C10) to calculate the total sales in 2017.

Calculate the total of inbound and outbound items: Assume that G is listed as the product name, and K and M are listed as inbound and outbound quantities. You can use =SUMIF(G2:G10, "Inbound", K2:K10) and =SUMIF(G2 :G10, "Outbound", M2:M10) to calculate the sum of the inbound and outbound quantities respectively.

Through the above methods and examples, the SUMIF function can be flexibly used to perform data summation operations under various conditions.

Related articles更多>>