当前位置:网站首页>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;

边栏推荐
- "APEC industry +" biov Tech talks about the cross-border of Chinese biotechnology enterprises and "Pratt & Whitney Kangyu" | apec-hub public welfare
- hr竟主动给这位测试小姐姐涨工资,她是怎么做到的?
- JMeter stress testing and agent recording
- Everything is an object
- Eyeshot 2022 Released
- Activereportsjs V3.0 comes on stage
- Semantic segmentation cvpr2019-advance: advantageous enterprise minimization for domain adaptation in semantic segmentation
- JSON Library Tutorial from scratch (III): parsing strings, learning and sorting notes
- Deep learning non local neural networks
- 2022.1.21 diary
猜你喜欢

Semantic segmentation cvpr2019-advance: advantageous enterprise minimization for domain adaptation in semantic segmentation

Svg code snippet of loading animation

BUUCTF(web:1-50)

Mirror image of binary tree

February 20ctf record

Detailed summary of flex layout

Depth of binary tree
![[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](/img/12/d41f8d5abcb61d2632a8b117bf1604.jpg)
[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

Matlab notes

Stack and Queue
随机推荐
Activereportsjs V3.0 comes on stage
A review of small sample learning
Jason learning
CUDA compilation error
Ranorex Studio 10.1 Crack
Database overview
CVPR2021-Semi-supervised Domain Adaptation based on Dual-level Domain Mixing for Semantic Segmentati
CSRF (Cross Site Request Forgery) &ssrf (server request forgery) (IV)
Vue uses keep alive to cache page optimization projects
JSON Library Tutorial from scratch (III): parsing strings, learning and sorting notes
Critical dependency: require function is used in a way in which dependencies
Baidu ueeditor set toolbar initial value
How to choose the years of investment in financial products?
Personalized Federated Learning with Moreau Envelopes
Database low-end SQL query statement fragment
2022.1.23 diary
Handwritten promise all
2021-03-23
Go implements LRU cache
Bind simulation, key points of interpreting bind handwritten code [details]