SUMPRODUCT (SMALL) FORMULA

Digby

New Member
Joined
Nov 16, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I have a row of numerical values that contain a zero in some cells. I want to count the smallest eight values excluding the cells with zero values. A number of cells have the same value, e.g. there could, conceivably, be more than eight with the lowest value. Does this have an impact on the formula?

I have attempted to modify the formula to insert the element that will ignore any zero values without any success.

The formula will be entered into cell E6.

My current formula is =SUMPRODUCT(SMALL(D13:D64,{1,2,3,4,5,6.7.8}))/C3. How do I correct this formula to so that cells with a zero value are ignored?

Thanks in advance

D
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the MrExcel forum!

Try:

=SUM(AGGREGATE(15,6,1/(1/D3:D64),{1,2,3,4,5,6,7,8}))/C3
 
Upvote 0
Are you using 365, or an earlier version?
Also what language is your version of Excel.
 
Upvote 0
Eric's solution should work for you at least with Excel 2010 and later
I did not include the C3 calculation

You stated Row but your formula shows a Column of data
I used a range B1:B8 then used the =COUNTIF(D13:D64,0)
Each formula gives the correct result.

T202011a.xlsm
ABCDE
12928
23035
33135
43235
53335
634
735
836
9
10
11
12
131
142
153
164
175
186
197
207
217
2210
2311
2412
2513
2614
2715
2816
2917
3018
3119
3220
3321
3422
3523
3624
370
380
390
400
410
420
430
440
450
460
470
480
490
500
510
520
530
540
550
560
570
580
590
600
610
620
630
640
9b
Cell Formulas
RangeFormula
C1C1=COUNTIF(D13:D64,0)
C2C2=SUM(SMALL(D13:D64,{29,30,31,32,33,34,35,36}))
C3C3=SUM(SMALL(D13:D64,B1:B8))
C4C4=SUMPRODUCT(SMALL(D13:D64,B1:B8))
C5C5=SUM(AGGREGATE(15,6,1/(1/D3:D64),{1,2,3,4,5,6,7,8}))
B1:B8B1=ROW()+$C$1
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Are you using 365, or an earlier version?
Also what language is your version of Excel.
Fluff, thanks for your help, I use MS365 - en - us version 16.013328.20356. In my call for help I used the term 'row' and meant 'column'. The column starts life unpopulated and starts at D13 through to D64. Each cell in the column is, over time, populated with a value, a whole number, e.g. 66. When, say, nine cells in descending order have been populated I want the sum of the smallest eight. However, some cells will have remained at zero and some cells may have the same value. As more cells are populated I want to obtain the sum of the smallest eight excluding zero. There are 52 cells in total. When all the cells are populated there will be a number of zero values and it is likely that the smallest value will have been entered on more than eight occasions, I still want the sum to be the value of the eight smallest.

I trust this helps, and again thanks.

D
 
Upvote 0
Eric's solution should work for you at least with Excel 2010 and later
I did not include the C3 calculation

You stated Row but your formula shows a Column of data
I used a range B1:B8 then used the =COUNTIF(D13:D64,0)
Each formula gives the correct result.

T202011a.xlsm
ABCDE
12928
23035
33135
43235
53335
634
735
836
9
10
11
12
131
142
153
164
175
186
197
207
217
2210
2311
2412
2513
2614
2715
2816
2917
3018
3119
3220
3321
3422
3523
3624
370
380
390
400
410
420
430
440
450
460
470
480
490
500
510
520
530
540
550
560
570
580
590
600
610
620
630
640
9b
Cell Formulas
RangeFormula
C1C1=COUNTIF(D13:D64,0)
C2C2=SUM(SMALL(D13:D64,{29,30,31,32,33,34,35,36}))
C3C3=SUM(SMALL(D13:D64,B1:B8))
C4C4=SUMPRODUCT(SMALL(D13:D64,B1:B8))
C5C5=SUM(AGGREGATE(15,6,1/(1/D3:D64),{1,2,3,4,5,6,7,8}))
B1:B8B1=ROW()+$C$1
Press CTRL+SHIFT+ENTER to enter array formulas.
Eric's solution should work for you at least with Excel 2010 and later
I did not include the C3 calculation

You stated Row but your formula shows a Column of data
I used a range B1:B8 then used the =COUNTIF(D13:D64,0)
Each formula gives the correct result.

T202011a.xlsm
ABCDE
12928
23035
33135
43235
53335
634
735
836
9
10
11
12
131
142
153
164
175
186
197
207
217
2210
2311
2412
2513
2614
2715
2816
2917
3018
3119
3220
3321
3422
3523
3624
370
380
390
400
410
420
430
440
450
460
470
480
490
500
510
520
530
540
550
560
570
580
590
600
610
620
630
640
9b
Cell Formulas
RangeFormula
C1C1=COUNTIF(D13:D64,0)
C2C2=SUM(SMALL(D13:D64,{29,30,31,32,33,34,35,36}))
C3C3=SUM(SMALL(D13:D64,B1:B8))
C4C4=SUMPRODUCT(SMALL(D13:D64,B1:B8))
C5C5=SUM(AGGREGATE(15,6,1/(1/D3:D64),{1,2,3,4,5,6,7,8}))
B1:B8B1=ROW()+$C$1
Press CTRL+SHIFT+ENTER to enter array formulas.
Dave, thanks for your prompt response, appreciated. My apology for the confusion, the sum required is a column. I will try your suggestions but in the meantime some, hopefu;lly, clarity;

Also what language is your version of Excel.
Fluff, thanks for your help, I use MS365 - en - us version 16.013328.20356. In my call for help I used the term 'row' and meant 'column'. The column starts life unpopulated and starts at D13 through to D64. Each cell in the column is, over time, populated with a value, a whole number, e.g. 66. When, say, nine cells in descending order have been populated I want the sum of the smallest eight. However, some cells will have remained at zero and some cells may have the same value. As more cells are populated I want to obtain the sum of the smallest eight excluding any zero. There are 52 cells in total. When all the cells are populated there will be a number of zero values and it is likely that the smallest value will have been entered on more than eight occasions, I still want the sum to be the value of the eight smallest.

So I need to establish the sum of the eight smallest from the moment the 9th cell in desending order as a number. Each cell corresponds to a weekly event. It is possible that when nine are populated that some will be at zero. If the formula only works when eight out of the fifty two have a number greater tha zero, then that's fine. FYI I have the a similar column that counts the largest, and this works with =SUMPRODUCT(LARGE(E13:E64,{1,2,3,4,5,6,7,8}))/C3. If I change 'LARGE' to 'SMALL' in this formula it returns the value of the eight smallest until there is a cell in the sequence with a zero.
 
Upvote 0
Welcome to the MrExcel forum!

Try:

=SUM(AGGREGATE(15,6,1/(1/D3:D64),{1,2,3,4,5,6,7,8}))/C3
Eric, further to my previous reply I have found an ugly solution. Using my formula but with the cells that would have '0' being blank. It works but it's not nice.

Could you explain why your formula uses D3? In my worksheet the sum of the formula is linked to E4. D3 to D12 are used for other calculations.

Last whilst my get around works I would like to have a formula that works when '0' is ignored.

I use =SMALL(E13:E64,COUNTIF(E13:E64,0)+1) for another column where the sum is displayed in E10. It works fine. I have attempted to insert the part highlighted into my other formula in an endeavor to get the formula to ignore '0'. I've failed to find a solution.
 
Upvote 0
to Digby
1. It is not necessary to quote entire suggestions.
2. You stated "I use =SMALL(E13:E64,COUNTIF(E13:E64,0)+1)" Review or try the alternative/workaround that I suggested.
3. You can enter the suggestions where they are required.
4. The suggestions appear to answer your question.

 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,241
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top