当前位置:网站首页>Classic usage of the sumproduct function
Classic usage of the sumproduct function
2022-06-25 05:31:00 【qq_ forty-one million five hundred and fifty-four thousand six 】
SUMPRODUCT The function is excel07 A function added after version , Versatile and powerful , yes excel A shining star in , Today, let's look at the usage of this function .
grammar :=SUMPRODUCT(array1,array2,array3, …),Array Is an array .
In a given set of arrays , Then multiply the elements of the array , Finally, we return the sum of the products .
SUM It means to sum ,PRODUCT It means quadrature , Together means the sum of products .
Several classic uses of functions :
One 、 And SUM Function usage comparison
example : Find the total sales quantity in the figure below , SUMPRODUCT(B2:B11)=SUM(B2:B11)
Find the total sales amount :=SUMPRODUCT(B2:B11*C2:C11) enter
perhaps =SUM(B2:B11*C2:C11) Press Ctrl+Shife+Enter Three keys end

SUMPRODUCT Function supports array operation , There is no need to press Ctrl+Shife+Enter Three keys end , Its operation principle is
When SUMPRODUCT When the arguments of the function are two arrays , You can use a multiplication sign or a comma in the middle , Or you could write it as =SUMRPODUCT(B2:B11,C2:C11) Multiply the corresponding elements between arrays , And then sum up , Above picture =SUMPRODUCT(B2:B11C2:C11)=SUMPRODUCT(B2:B11,C2:C11)=B2C2+B3C3+B4C4+······+B11*C11
The difference between using a multiplication sign and using a comma is in , When there is text in an array , Use the multiplication sign in the middle to get the wrong value , Because the text cannot participate in the calculation , At this time, the middle can only be separated by commas , Then the text will be treated as 0 To deal with it ;

Find the total sales volume , Input =SUMPRODUCT(B2:B11,C2:C11)
Two 、 Summation of separated columns
example : seek 1、2、3、4 Sum of planned quantity of the month , stay N3 Input =SUMPUDUCT((MOD(COLUMN(B3:M3),3)=2)*B3:M3), Drop down fill .

paraphrase :COLUMN function , Returns the number of columns in the selected cell , Such as the input =COLUMN(B5), The result is 2, intend B5 The cell is the second column , Input =COLUMN(G17), The result is 7, intend G17 The cell in which it is located is the 7 Column ,COLUMN(B3:M3), intend B3 To M3 Number of columns , Get the results {2,3,4,5,6,7,8,9,10,11,12,13}
MOD function , A function used to find the remainder , Returns the remainder of the division of two numbers , Input =MOD(5,2), The result is 1, intend 5 Divide 2 The remainder is 1, Input =MOD(17,3), The result is 2, intend 17 Divide 3 The remainder is 2,MOD(COLUMN(B3:M3),3)=2, intend B3:M3 Divide the number of columns by 3, The remainder is 2 Cells of , And what you get is {TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE}, In this TRUE It's true , Consistent with the results ,FALSE For false , Does not meet the results . In calculation TRUE As a 1 Calculation ,FALSE Press 0 Calculation
Calculation formula :=SUMPRODUCT((MOD(COLUMN(B3:M3),3)=2)*B3:M3)
=SUMPRODUCT({1,0,0,1,0,0,1,0,0,1,0,0}*{68,81,13,70,83,13,107,71,-36,85,118,33})=330
Element one between two arrays One corresponds to multiply and then sum .
In this example, you can also use SUMIF function ,N3 Input in =SUMIF($B 2 : 2: 2:M 2 , 2, 2,K$2,B3:M3) Drop down fill , Be careful B2:M2 Absolute reference to ;
without “ plan 、 actual 、 differences ” Where the line is ( Delete the second line ), You can't use SUMIF function , use SUMPRDUCT The function is better
3、 ... and 、 To sum by many conditions
Formula usage :=SUMPRODUCT( Conditions 1 Conditions 2 Conditions 3*······ Conditions N) , Multiple conditions in the formula are multiplied .
example : Find... In the figure below 2017 year 3 month 2 Nichong Ji 21 The amount of computer sales per hour , Input =SUMPRODUCT((A2:A18=–“2017/03/02”)(B2:B18=“ The computer ”)(C2:C18=“ Acer 21 " ”)*F2:F18) Double minus sign before date “–” It is used to convert logical values

seek 2017 year 3 month 3 Millet, 5.5 The amount of mobile phone sales per hour , Input =SUMPRODUCT((A2:A18=–“2017/3/3”)(B2:B18=“ mobile phone ”)(C2:C18=“ millet 5.5 " ”)*F2:F18), Add a double minus sign before the date
You can also use SUMIFS function , Input =SUMIFS(F2:F18,A2:A18,“2017/3/3”,B2:B18,“ mobile phone ”,C2:C18,“ millet 5.5 " ”)
The figure below shows the total sales volume in Northeast and Northwest China , Input =SUMPRODUCT(((A2:A10=“ The northeast ”)+(A2:A10=“ The northwest ”)),B2:B10)

Add the first two conditions ,=SUMPRODUCT(((A2:A10=“ The northeast ”)+(A2:A10=“ The northwest ”)),B2:B10)
=SUMPRODUCT((A2:A10=“ The northeast ”),B2:B10)+SUMPRODUCT((A2:A10=“ The northwest ”),B2:B10)
Four 、 Multi condition counting
Image input =SUMPRODUCT((B2:B16>=80)*(C2:C16>=80))

paraphrase : The first condition B2:B16>=80, When B2:B16 The area is qualified >=80 when , Show 1, Otherwise, it will show 0, The other condition is the same
=SUMPRODUCT((B2:B16>=80)*(C2:C16>=80))
=SUMPRODUCT({0;1;1;0;1;1;0;0;0;0;0;0;1;1;0}*{1;1;1;1;1;1;0;0;0;0;0;1;0;1;0}) Multiply two pairs and sum them
This example can also be used COUNTIFS function , Input =COUNTIFS(B2:B16,">=80",C2:C16,">=80")
5、 ... and 、 Condition ranking
The following figure , Ranking , stay C2 Input =SUMPRODUCT(($B 2 : 2: 2:B$16>B2)*1)+1 Fill down
The meaning of the formula : stay B2:B16 In the region , multiply 1, Convert it into an array to participate in the operation , Add 1(+1) It's kanbi B2(79) There are several large numbers of achievements , If there is 6 individual , be B2 What's your ranking 7;

边栏推荐
- Japanese fifty tone diagram
- Stack and Queue
- The article is on the list. Welcome to learn
- [relax's law of life lying on the square] those poisonous chicken soup that seem to be too light and too heavy, but think carefully and fear
- CopyPlugin Invalid Options options should be array ValidationError: CopyPlugin Invalid Options
- Small sample learning data set
- Drag modal box
- Matlab notes
- Go Context - Cancelation and Propagation
- BUUCTF(web:1-50)
猜你喜欢

滲透測試-提權專題

Reading and writing of nodejs excel (.Xlsx) files

Monkey test of APP automation

Five simple data types of JS

A review of small sample learning

Small sample learning data set

3.2.3 use tcpdump to observe TCP header information (supplement common knowledge of TCP protocol)

1.6.3 use tcpdump to observe DNS communication process

Route parameters to jump to the page and transfer parameters -- > hidden parameter list

Create an environment for new projects
随机推荐
Detailed summary of float
Deeply understand the characteristics of standard flow and off standard elements
Semantic segmentation cvpr2019-advance: advantageous enterprise minimization for domain adaptation in semantic segmentation
2021-03-23
[OSPF routing calculation (class I LSA router, class II LSA network, and class III LSA sum net)] -20211228-30
Array introduction plus example 01
Reading and writing of nodejs excel (.Xlsx) files
Database overview
Drag modal box
CopyPlugin Invalid Options options should be array ValidationError: CopyPlugin Invalid Options
Creation and use of MySQL index
Essais de pénétration - sujets d'autorisation
C language -- Sanzi chess
Use serialize in egg to read and write split tables
Deep analysis of epoll reactor code
2022.1.21 diary
File upload vulnerability (III)
Depth of binary tree
How to install the blue lake plug-in to support Photoshop CC 2017
Electronic Society C language level 1 28, character diamond