Two column lookup in table array using INDEX and MATCH

◇◆丶佛笑我妖孽 提交于 2019-11-26 16:49:06

Try an array formula (CTRL + SHIFT + ENTER) instead of Enter.

=INDEX(K9:K53,MATCH(K3&K4,I9:I53&J9:J53,0),1)

Not tested but should work.

Will edit later explaining our formula and reason why your formula doesn't work.

Your column_num parameter on the INDEX function cannot sinply provide a secondary row criteria. You need a way to ensure a two column match on the row_num parameter and leave the column_num either blank or as 1 (there is only only column in K9:K53).

The standard formula for K5 should be,

=index(K9:K53, aggregate(15, 6, row(1:45)/((i9:i53=k3)*(j9:j53=k4)), 1))

... or,

=index(K9:K53, min(index(row(1:45)+((i9:i53<>k3)+(j9:j53<>k4))*1e99, , )))

The cell range K9:K53 has a total of 45 rows. The position within K9:K53 will be within ROW(1:45). The first formula forces any non-matching row into an #DIV/0! error state and the AGGREGATE¹ function uses option 6 to ignore errors while retrieving the smallest valid entry with the SMALL sub-function (e.g. 15). The second formula performs the same action by adding 1E+99 (a 1 followed by 99 zeroes) to any non-matching row and taking the smallest matching row with the MIN function.

      


¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!