I would like excel to display the value from table array which has two matching cells com_cd
and div_cd
using INDEX
and MATCH
.
I have tried the following formula but it did not work.
=INDEX(K9:K53,MATCH(K3,I9:I53,0),MATCH(K4,J9:J53,0))
Here is a screenshot of the excel sheet with the desired result given according to com_cd
and div_cd
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,
... or,
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.
Try an array formula
(CTRL + SHIFT + ENTER)
instead ofEnter
.Not tested but should work.
Will edit later explaining our formula and reason why your formula doesn't work.