当前位置:网站首页>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;
边栏推荐
- Ranorex Studio 10.1 Crack
- Dynamic programming example 2 leetcode62 unique paths
- ArcGIS Engine + Visual Studio installation tutorial
- Deep learning non local neural networks
- XSS (cross site script attack) summary (II)
- HR took the initiative to raise the salary of the test lady. How did she do it?
- Use js to simply implement the apply, call and bind methods
- Can bus extended frame
- How to choose the years of investment in financial products?
- JS verification code input number auto skip
猜你喜欢
Essais de pénétration - sujets d'autorisation
Summary of SQL injection (I)
JSON Library Tutorial from scratch (III): parsing strings, learning and sorting notes
Professional things use professional people
Baidu ueeditor set toolbar initial value
Route parameters to jump to the page and transfer parameters -- > hidden parameter list
Semantic segmentation cvpr2019-advance: advantageous enterprise minimization for domain adaptation in semantic segmentation
Penetration test - right raising topic
Notes on non replacement elements in the line (padding, margin, and border)
Monkey test of APP automation
随机推荐
Eyeshot Ultimate 2022 Crack By Xacker
Large number operation (capable of square root, power, permutation and combination, logarithm and trigonometric value)
Jason learning
Small sample learning data set
Instant messaging project (I)
Using JS to realize the sidebar of life information network
Use of pytorch tensorboard
Pytorch- daily learning notes of some small functions involving training
Go implements LRU cache
渗透测试-提权专题
Everything is an object
The article is on the list. Welcome to learn
Database overview
On Transform
Stack and Queue
SRC platform summary
Creation and use of MySQL index
Matlab notes
About the definition of pointer variables (personal notes)
Understand JS high-order function and write a high-order function