Minimum v-lookup using multiple conditions

Mezner

New Member
Joined
Jun 3, 2015
Messages
2
Hi all,

I've searched the forum for similair instances. I found some, but they don't include MULTIPLE conditions. Whatever I'm doing is not working and sends a 'Value?' error message.


I have a large database of origin/destinations. There may be as many as 10 different 'rates' for each origin/destination combo and I want to find the smallest value for each. Below is just a tiny example of the table.

Essentially I'm creating a "grid" to help me filter rapidly. The grid for the example would look something like below. I was trying to create an IF statment that I could drag across all the cells MIN(IF(Origin=$A$2 AND Destination = B1,))). That way I could drag it across, say, 20 different desinations for the same origin.

FargoGrand Forks
Minneapolisxx

<tbody>
</tbody><colgroup><col><col><col></colgroup>


OriginDestinationCarrierRate
MinneapolisFargoA0.01
MinneapolisGrand ForksB0.015
MinneapolisGrand ForksC 0.012

<tbody>
</tbody><colgroup><col><col><col><col></colgroup>
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This might work. Keep in mind that these array formulas must be entered with CTRL + SHFT + Enter. (You can enter the first one properly in C16 and copy it across and down.)


Excel 2012
ABCDEFG
1OriginDestinationCarrierRate
2MinneapolisFargoA0.010
3MinneapolisGrand ForksB0.015
4MinneapolisGrand ForksC0.012
5CalgaryEdmontonA0.015
6CalgaryFargoA0.014
7CalgaryFargoB0.016
8CalgaryGrand ForksB0.013
9VancouverChicagoC0.100
10MontrealVicotriaA0.150
11VicotriaChicagoA0.016
12VicotriaChicagoC0.018
13
14destination
15FargoGrand ForksEdmontonChicagoVicotria
16Minneapolis0.0100.0120.0000.0000.000
17Calgary0.0140.0130.0150.0000.000
18originVancouver0.0000.0000.0000.1000.000
19Montreal0.0000.0000.0000.0000.150
20Vicotria0.0000.0000.0000.0160.000
21
22N.B. Formulas are CTRL+SHFT+ENTR
Sheet28
Cell Formulas
RangeFormula
C16{=MIN(IF(($B$2:$B$12=$B16)*($C$2:$C$12=C$15),$E$2:$E$12))}
C17{=MIN(IF(($B$2:$B$12=$B17)*($C$2:$C$12=C$15),$E$2:$E$12))}
C18{=MIN(IF(($B$2:$B$12=$B18)*($C$2:$C$12=C$15),$E$2:$E$12))}
C19{=MIN(IF(($B$2:$B$12=$B19)*($C$2:$C$12=C$15),$E$2:$E$12))}
C20{=MIN(IF(($B$2:$B$12=$B20)*($C$2:$C$12=C$15),$E$2:$E$12))}
D16{=MIN(IF(($B$2:$B$12=$B16)*($C$2:$C$12=D$15),$E$2:$E$12))}
D17{=MIN(IF(($B$2:$B$12=$B17)*($C$2:$C$12=D$15),$E$2:$E$12))}
D18{=MIN(IF(($B$2:$B$12=$B18)*($C$2:$C$12=D$15),$E$2:$E$12))}
D19{=MIN(IF(($B$2:$B$12=$B19)*($C$2:$C$12=D$15),$E$2:$E$12))}
D20{=MIN(IF(($B$2:$B$12=$B20)*($C$2:$C$12=D$15),$E$2:$E$12))}
E16{=MIN(IF(($B$2:$B$12=$B16)*($C$2:$C$12=E$15),$E$2:$E$12))}
E17{=MIN(IF(($B$2:$B$12=$B17)*($C$2:$C$12=E$15),$E$2:$E$12))}
E18{=MIN(IF(($B$2:$B$12=$B18)*($C$2:$C$12=E$15),$E$2:$E$12))}
E19{=MIN(IF(($B$2:$B$12=$B19)*($C$2:$C$12=E$15),$E$2:$E$12))}
E20{=MIN(IF(($B$2:$B$12=$B20)*($C$2:$C$12=E$15),$E$2:$E$12))}
F16{=MIN(IF(($B$2:$B$12=$B16)*($C$2:$C$12=F$15),$E$2:$E$12))}
F17{=MIN(IF(($B$2:$B$12=$B17)*($C$2:$C$12=F$15),$E$2:$E$12))}
F18{=MIN(IF(($B$2:$B$12=$B18)*($C$2:$C$12=F$15),$E$2:$E$12))}
F19{=MIN(IF(($B$2:$B$12=$B19)*($C$2:$C$12=F$15),$E$2:$E$12))}
F20{=MIN(IF(($B$2:$B$12=$B20)*($C$2:$C$12=F$15),$E$2:$E$12))}
G16{=MIN(IF(($B$2:$B$12=$B16)*($C$2:$C$12=G$15),$E$2:$E$12))}
G17{=MIN(IF(($B$2:$B$12=$B17)*($C$2:$C$12=G$15),$E$2:$E$12))}
G18{=MIN(IF(($B$2:$B$12=$B18)*($C$2:$C$12=G$15),$E$2:$E$12))}
G19{=MIN(IF(($B$2:$B$12=$B19)*($C$2:$C$12=G$15),$E$2:$E$12))}
G20{=MIN(IF(($B$2:$B$12=$B20)*($C$2:$C$12=G$15),$E$2:$E$12))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
TY. I don't know why it wasn't working before (I knew it had to be an array), but I followed your formula structure and added my named tables/fields to make it work. Sweet!

My formula looks a little like this:

{=MIN(IF((Freights[Origin]=$F$3)*(Freights[Destination]=G$2),Freights[Rate]))}

Comes out pretty nifty, especially since I have over 2,200 rows of data (and only 30 destinations).
 
Upvote 0
TY. I don't know why it wasn't working before (I knew it had to be an array), but I followed your formula structure and added my named tables/fields to make it work. Sweet!

My formula looks a little like this:

{=MIN(IF((Freights[Origin]=$F$3)*(Freights[Destination]=G$2),Freights[Rate]))}

Comes out pretty nifty, especially since I have over 2,200 rows of data (and only 30 destinations).

{=IFERROR(1/(1/MIN(IF(Freights[Origin]=$F$3,IF(Freights[Destination]=G$2,Freights[Rate])))),"Not available")}

does not return a possibly non-admissible zero as result.
 
Upvote 0

Forum statistics

Threads
1,207,443
Messages
6,078,589
Members
446,350
Latest member
FrancieRech

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