In excel I hace a grid showing prices for items which we lookup size. The first row has width sizes and the first column has length sizes. We use the following to do this lookup.
'=INDEX(Wide,MIN(COUNT(D$144$159),COUNT(D$144
$159)-COUNTIF(D$144
$159,">="&H162)+1),MIN(COUNT(E$143:W$143),COUNT(E$ 143:W$143)-COUNTIF(E$143:W$143,">="&G162)+1))