Help with zeros and blanks in a MIN or SMALL function

mcbrown

New Member
Joined
Nov 2, 2011
Messages
2
I am trying to write a MIN or SMALL function that finds the smalles non-zero number in Column B that matches a criteria in Column A. I don't get the right result at times. For example, when I use the formula and data below I get "problem" when I should get 2. However, it seems to work if B2 is a number greater than zero. If B2 is zero, it also returns "problem".

{=IF(MIN(IF((A1:A7=5),B1:B7))>0,MIN(IF((A1:A7=5),B1:B7)),"problem")}

Column A Column B
Row 1 5 8
Row 2 5
Row 3 3 9
Row 4 3 3
Row 5 5 2
Row 6 4 1
Row 7 1 0

Can you help me?

Thanks!,

Mark
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I am trying to write a MIN or SMALL function that finds the smalles non-zero number in Column B that matches a criteria in Column A. I don't get the right result at times. For example, when I use the formula and data below I get "problem" when I should get 2. However, it seems to work if B2 is a number greater than zero. If B2 is zero, it also returns "problem".

{=IF(MIN(IF((A1:A7=5),B1:B7))>0,MIN(IF((A1:A7=5),B1:B7)),"problem")}

Column A Column B
Row 1 5 8
Row 2 5
Row 3 3 9
Row 4 3 3
Row 5 5 2
Row 6 4 1
Row 7 1 0

Can you help me?

Thanks!,

Mark
D2: 5

Control+shift+enter, not just enter:

=MIN(IF(A2:A8>=D2,IF(B2:B8>0,B2:B8)))

should succeed.

If you want to have some control...

=IF(COUNTIF(A2:A8,D2),MIN(IF(A2:A8>=D2,IF(B2:B8>0,B2:B8))),"Not Available")
 
Upvote 0

Forum statistics

Threads
1,203,522
Messages
6,055,893
Members
444,832
Latest member
Kauri

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