SUM function, 80% of people don’t know the usage?

The main function of the SUM function is to calculate the sum of numbers and return the sum of numbers, logical values ​​and text expressions of numbers in a certain cell area. Today I will introduce you to the usage of SUM

SUM function function

The SUM function is one of the most commonly used functions in Excel and is used to calculate the sum of numbers.

SUM function syntax

SUM(number1,[number2],…)

Parameter Description

number1 (required): indicates the first number of the required sum, which can be a directly input number, a cell reference or an array.

number2,...(optional): Represents the 2nd to 255th digits required to be summed, which can be directly entered numbers, cell references or arrays.

Precautions for the use of the SUM function

(1) If the value of the parameter is directly input in the SUM function, the parameter must be a numeric type, that is, a number, a text format number or a logical value. If it is of other types, the SUM function will return the error value #VALUE!.

(2) If you use cell references or arrays as the parameters of the SUM function, the parameters must be numbers, and other types of values ​​will be ignored.

(3) If it is a text-type number parameter, the SUM function can be directly summed; if it is a text-type number in a quoted cell (a single quotation mark "'" is added before the number of the cell), the sum will be ignored .

Examples of common usage of SUM function:

1. Calculate the total sales of apples and bananas

Enter in cell H2:

=SUM(D2:E11)

Insert picture description here

2. Calculate the total sales of Apple sales> 400

Enter in cell H2:

{=SUM((D2:D11>400)*D2:D11)}

After entering the formula, press and hold the [Ctrl+Shift+Enter] key combination at the same time to display the outside "{}".
Insert picture description here

Formula analysis:

 首先判断区域 D2:D11 中大于400的单元格,得到一个包含逻辑值TRUE 和 FALSE 的数组。然后将此数组与区域D2:D11中的对应单元格相乘,得到一个包含 1 和 0 的数组,最后使用 SUM 函数对该数组求和,即可得到符合条件的销量总和。

3. Count how many girls are in the second group

Enter in cell H2:

{=SUM((C2:C11="Second Group")*(B2:B11="Female"))}

After entering the formula, press and hold the [Ctrl+Shift+Enter] key combination at the same time to display the outside "{}".
Insert picture description here
Formula analysis: The
SUM function contains two arrays. The first array determines whether the value in the area C2:C11 is "two groups", and the second array determines whether the value in the area C2:C11 is "female". The result is an array containing logical values. Multiply these two arrays to convert the logical value into an array containing 1 and 0, and then use the SUM function to sum the array to calculate how many girls there are in the two groups.

4. Count the total sales of bananas for the second group of girls

Enter in cell H2:

{=SUM((C2:C11="Second Group")*(B2:B11="Female")*E2:E11)}

After entering the formula, press and hold the [Ctrl+Shift+Enter] key combination at the same time to display the outside "{}".
Insert picture description here
Formula analysis:

The SUM function contains two arrays. The first array determines whether the value in the area C2:C11 is "two groups", the second array determines whether the value in the area C2:C11 is "female", and the result of the judgment is that it contains Array of logical values. Then multiply this array with the corresponding cells in the range E2:E11 to get an array containing 1 and 0, and finally use the SUM function to sum the array to get the total sales volume that meets the conditions.

Have you learnt that?

Welcome to follow forwardInsert picture description here

Guess you like

Origin blog.csdn.net/weixin_43152686/article/details/109283332