Using array formula to 'vlookup' the lowest value in a list, avoiding blanks

booms

Board Regular
Joined
Dec 2, 2010
Messages
60
Hi all,

I've been trying to set up a formula to see vlookup the lowest value for a data set that will have multiple numeric values associated with a descriptor. I've found this array formula on this forum:

{=MIN(IF($A$2:$A$20=A2,$B$2:$B$20))}

That works great, except there are blanks in my data and I'm trying to avoid those. Is there any way to avoid this query returning a zero when it comes across a blank cell?

Thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You could use
{=MIN(IF($A$2:$A$20=A2,IF($B$2:$B$20<>"",$B$2:$B$20)))}

or, if Excel 2010 or later, this formula that doesn't require the Array formula entry.
=AGGREGATE(15,6,$B$2:$B$20/(($A$2:$A$20=A2)*($B$2:$B$20<>"")),1)
 
Upvote 0
Further comments.

Assuming no negative values in column B, if a cell in that column does actually contain a zero, and the column A value matches A2, all suggested formulas will correctly return 0 as the answer.

However, if all rows that match A2 in column A are blank in column B then MINIFS and the MIN(IF array formula incorrectly return 0 as the minimum whereas the AGGREGATE function returns an error that would allow you to handle that circumstance.
 
Upvote 0
Too many qualifications can be a burden, but then...

=IF(A2="","not available",MINIFS($B$2:$B$20,$A$2:$A$20,A2))
 
Upvote 0
Too many qualifications can be a burden, but then...

=IF(A2="","not available",MINIFS($B$2:$B$20,$A$2:$A$20,A2))
I can't see how that would work. I would have thought you would need something more like
=IF(COUNTIFS($A$2:$A$20,A2,B2:B20,"<>"),MINIFS($B$2:$B$20,$A$2:$A$20,A2),"not available")

or, if no MINIFS
=IFERROR(AGGREGATE(15,6,$B$2:$B$20/(($A$2:$A$20=A2)*($B$2:$B$20<>"")),1),"not available")
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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