Index Match formula with 2 criteria for numbers

I have a table with data and need to match 2 separate criteria and return the value from another column. I do this easily with excel but it's not working in numbers, can someone help ?

Posted on Jun 1, 2021 10:22 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 2, 2021 12:35 AM

Well, a bit of guessing here from the example you gave but it looks as if you want to retrieve the score for a given AllyCode and MapStatId. If that assumption is correct then you can use SUMIFS like this:




The formula in C2 filled/copied right and down:


=SUMIFS(stats::$G,stats::$D,$B2,stats::$C,C$1)


SUMIFS takes arguments like this:



This works if there is only one score for each pair of AllyCode and MapStatId. AVERAGEIFS would also work.


Note that your original INDEX MATCH combination doesn't work, either in Excel or Numbers, because for a two-dimensional range. one MATCH needs to give you a vertical coordinate and one a horizontal coordinate.


If needed to retrieve a non-numerical value unlike score then you could add an extra column concatenating AllyCode and MapStatid and match against that column. Then you need to match horizontally to get the other argument for INDEX. That's more complicated than just using SUMIFS, but post if you need that.



SG


8 replies
Question marked as Top-ranking reply

Jun 2, 2021 12:35 AM in response to Frank JS

Well, a bit of guessing here from the example you gave but it looks as if you want to retrieve the score for a given AllyCode and MapStatId. If that assumption is correct then you can use SUMIFS like this:




The formula in C2 filled/copied right and down:


=SUMIFS(stats::$G,stats::$D,$B2,stats::$C,C$1)


SUMIFS takes arguments like this:



This works if there is only one score for each pair of AllyCode and MapStatId. AVERAGEIFS would also work.


Note that your original INDEX MATCH combination doesn't work, either in Excel or Numbers, because for a two-dimensional range. one MATCH needs to give you a vertical coordinate and one a horizontal coordinate.


If needed to retrieve a non-numerical value unlike score then you could add an extra column concatenating AllyCode and MapStatid and match against that column. Then you need to match horizontally to get the other argument for INDEX. That's more complicated than just using SUMIFS, but post if you need that.



SG


Jun 2, 2021 8:13 PM in response to Badunit

I deleted my last post to determine why I was still getting results (incorrect ones) when there was no match. Figured it out.


I have been thinking about this multiple-criteria search problem. With MINFS and MAXIFS we have new options for multiple-criteria searches. It is no longer necessary to concatenate two or more fields and search on that. All it takes is one new column with the ROW function in it and you can search on any combination of the other columns. Use MINIFS to search for the multiple criteria and have it return the row number from that new column. Then use INDEX to get the data from whatever column you want it from. MINIFS does a top-down search. MAXIFS does a bottoms-up search.



MINIFS will return 0 (not an error) if there is no match so we have to check for that.


IF(MINIFS(Data Table::D,Data Table::A,A,Data Table::B,B)=0,"not found",INDEX(Data Table::C,MINIFS(Data Table::D,Data Table::A,A,Data Table::B,B)))


It would less complicated looking if I did the MINFS in one column and referenced it twice in the formula vs calling it twice in the formula.

Jun 3, 2021 4:18 PM in response to SGIII

SGIII wrote:

Good one for looking up non-numerical values! So SUMIFS for numerical, an extra column and INDEX MAXIFS for non-numerical.

SG

It can also be used instead of SUMIFS if there may be multiple matches. It gives a singular match where SUMIFS might sum multiple matches. If there is no possibility of multiple matches, though, SUMIFS is much simpler.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Index Match formula with 2 criteria for numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.