Finding the minimum of a subset

booms

Board Regular
Joined
Dec 2, 2010
Messages
60
Hi, this seems simple but I just can’t get it to work.





I’ve got two columns of data, and what I’m after is the third column.




I need a formula I can roll down that will set out the minimum of each group in the third column – I suspect an array would work?




Group

<tbody>
[TD="width: 28%"] Value
[/TD]
[TD="width: 18%"] Min of Group
[/TD]

[TD="width: 53%"] A
[/TD]
[TD="width: 28%"] -2
[/TD]
[TD="width: 18%"] -2
[/TD]

[TD="width: 53%"] A
[/TD]
[TD="width: 28%"] 4
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] A
[/TD]
[TD="width: 28%"] 0
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] B
[/TD]
[TD="width: 28%"] 3
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] B
[/TD]
[TD="width: 28%"] 6
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] B
[/TD]
[TD="width: 28%"] 0
[/TD]
[TD="width: 18%"] 0
[/TD]

[TD="width: 53%"] C
[/TD]
[TD="width: 28%"] -2
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] C
[/TD]
[TD="width: 28%"] -8
[/TD]
[TD="width: 18%"] -8
[/TD]

[TD="width: 53%"] D
[/TD]
[TD="width: 28%"] 3
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] D
[/TD]
[TD="width: 28%"] 9
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] D
[/TD]
[TD="width: 28%"] 4
[/TD]
[TD="width: 18%"][/TD]

[TD="width: 53%"] D
[/TD]
[TD="width: 28%"] -4
[/TD]
[TD="width: 18%"] -4
[/TD]

</tbody>














 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Enter this CTRL-SHIFT-ENTER:

=IF(B2=MIN(IF($A$2:$A$13=A2,$B$2:$B$13)),MIN(IF($A$2:$A$13=A2,$B$2:$B$13)),"")
 
Upvote 0
Actually could be simplified to:

=IF(B2=MIN(IF($A$2:$A$13=A2,$B$2:$B$13)),B2,"")
 
Upvote 0
Actually could be simplified to:

=IF(B2=MIN(IF($A$2:$A$13=A2,$B$2:$B$13)),B2,"")


Thanks again. Out of interest, I'm running this array over about 100,000 lines. It seems to run incredibly slowly (as in, would take half an hour to finish). Is that what you'd expect and is there any way to speed it up?
 
Upvote 0
Yes its a array formula so will be very slow. Can you use a pivot table? It would find the minimum values in blink of an eye
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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