Excel counts the proportion and ranking of an indicator under a certain dimension (application of SUMIF and SUMPRODUCT functions)

Requirements such as: Calculate the proportion and ranking of the number of users' records on the day in the total number of records on the day in the figure below

Insert picture description here

For similar needs, you can directly use the SUMIF and SUMPRODUCT functions in Excel to solve them. First, let's take a look at the syntax of these two functions.

SUMIF

Syntax: SUMIF (range, criteria, sum_range)
Parameter description: Range is the cell range used for condition judgment, Criteria is the judgment condition composed of numbers, logical expressions, etc., Sum_range is the cell, range or reference that needs to be summed .
Purpose: To sum a number of cells, ranges or references according to specified conditions.
Example: A certain unit counts the total wages of employees called "intermediate" in the salary report. Suppose the total salary is
stored in column F of the worksheet, and the employee title is stored in column B of the worksheet. The formula is "=SUMIF(B1:B1000, "Intermediate", F1:F1000)", where "B1:B1000" is
the cell range that provides the basis for logical judgment , and "Intermediate" is the judgment condition, which means only counting B1:B1000 The range is called "intermediate" cells, F1:F1000 is the actual sum of cells.

SUMPRODUCT

Syntax: SUMPRODUCT(array1, array2, array3,...)
Parameters: Array1, array2, array3,... are 2 to 30 arrays, and the corresponding elements need to be
multiplied and summed.
Purpose: In the given groups of arrays, multiply the corresponding elements between the arrays, and return the sum of the products.
Example:
The calculation result of the formula "=SUMPRODUCT({3,4;8,6;1,9},{2,7;6,7;5,3})" is 156.

Go back to the beginning of the requirement, ask the user for the proportion of the number of records on the day in the total number of records on the day, we enter in cell D2 =C2/SUMIF($A$2:$A$26,A2,$C$2:$C$26), and then select cell D2 to drop down to solve the problem
$A$2:$A$26is to put the A2-A26 data into the array, use In the cell area of ​​conditional judgment, A2 is the judgment value, which $C$2:$C$26is the area for the summation of requirements

Ask the user’s ranking of the percentage of the number of records of the day in the total number of records of the day . Enter
in cell E2 =SUMPRODUCT(($A$2:$A$28=A2)*($C$2:$C$28>C2))+1. After entering , you must press the combination key to run: shift+ctrl+enter, and then pull down
this method. I don’t want to understand how to calculate it. It should be returned. There are other ways, please comment on the area, thank you.

Guess you like

Origin blog.csdn.net/lz6363/article/details/109408758