SUM n smallest

jotari

New Member
Joined
May 23, 2011
Messages
11
Array formula {=SUM(LARGE(($B$2:$B$50)*($A$2:$A$50=D2),{1,2,3}))} works fine, but if I try to find SUM of 3 smallest, formula doesn't work. Why?
{=SUM(SMALL(($B$2:$B$50)*($A$2:$A$50=D2),{1,2,3}))}
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
The ($A$2:$A$50=D2) term makes a lot of the values zero, right?

Try

{=IF(COUNTIF($A$2:$A$50, D2) < 3, "Oops", SUM(SMALL(IF($A$2:$A$50=D2, $B$2:$B$50, 9E+307),{1,2,3})))}
 
Upvote 0
Array formula {=SUM(LARGE(($B$2:$B$50)*($A$2:$A$50=D2),{1,2,3}))} works fine, but if I try to find SUM of 3 smallest, formula doesn't work. Why?
{=SUM(SMALL(($B$2:$B$50)*($A$2:$A$50=D2),{1,2,3}))}

Better avoid pairwise multiplications. Invoke IF for filtering instead...

Control+shift+enter, not just enter:

=SUM(SMALL(IF(A2:A50=D2,B2:B50),{1,2,3}))
 
Upvote 0
One more question. Formula =SUM(SMALL(IF(A2:A50=D2,B2:B50),{1,2,3})) does not work if there is only 2 or 1 equal (=D2) number in column A.
What is the formula if I want anyway count those 2 together or just only one.
 
Upvote 0
One more question. Formula =SUM(SMALL(IF(A2:A50=D2,B2:B50),{1,2,3})) does not work if there is only 2 or 1 equal (=D2) number in column A.
What is the formula if I want anyway count those 2 together or just only one.

Control+shift+enter, not just enter:

=SUM(SMALL(IF(A2:A50=D2,B2:B50),ROW(INDIRECT("1:"&MIN(3,COUNTIF(A2:A50,D2))))))
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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