Formula to find max and min in a range

Ombir

Active Member
Joined
Oct 1, 2015
Messages
433
Hi Friends,

I need to find max and min from a given range based on criteria. Input and Output format is shown below.

Input:

AB
CodeNumber

<tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]01[/TD]
[TD="align: right"]1234[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]01[/TD]
[TD="align: right"]3445[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]01[/TD]
[TD="align: right"]566[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]01[/TD]
[TD="align: right"]66634[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]02[/TD]
[TD="align: right"]45678[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]02[/TD]
[TD="align: right"]33[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]02[/TD]
[TD="align: right"]456[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]03[/TD]
[TD="align: right"]3456[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]03[/TD]
[TD="align: right"]23[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]03[/TD]
[TD="align: right"]456[/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]03[/TD]
[TD="align: right"]678[/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]03[/TD]
[TD="align: right"]111[/TD]

</tbody>
Sheet2

[TABLE="width: 85%"]
<tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Output:

GHI
CodeMinMax

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]01[/TD]
[TD="align: right"]566[/TD]
[TD="align: right"]66634[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]02[/TD]
[TD="align: right"]33[/TD]
[TD="align: right"]45678[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]03[/TD]
[TD="align: right"]23[/TD]
[TD="align: right"]3456[/TD]

</tbody>
Sheet2

[TABLE="width: 85%"]
<tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Please help with some formulae. Thanks.
 
Try


Excel 2007
GHI
2CodeMinMax
3156666634
423345678
53233456
Sheet1
Cell Formulas
RangeFormula
H3{=MIN(IF($A$2:$A$13=1,$B$2:$B$13))}
H4{=MIN(IF($A$2:$A$13=2,$B$2:$B$13))}
H5{=MIN(IF($A$2:$A$13=3,$B$2:$B$13))}
I3{=MAX(IF($A$2:$A$13=1,$B$2:$B$13))}
I4{=MAX(IF($A$2:$A$13=2,$B$2:$B$13))}
I5{=MAX(IF($A$2:$A$13=3,$B$2:$B$13))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
@Michael M

Why hard coding 1, 2, 3... in your formula?
In H3: {=MIN(IF($A$2:$A$13=$G3,$B$2:$B$13))} and copy down
In I3: {=MAX(IF($A$2:$A$13=$G3,$B$2:$B$13))} and copy down

Makes sense?

Regards
XLearner
 
Upvote 0

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