Index+Match+Mode Function with Multiple Criteria

xaikus506

New Member
Joined
Oct 29, 2022
Messages
46
Office Version
  1. 365
Platform
  1. Windows
Hello, I would like to seek your assistance, I would like to know how to perform/encode the formula for index+match+mode with multiple criteria.

this is what I did, however this is only good for 1 criteria only,

1667048651459.png


I also did something like this to solve my issue, but it yields inaccurate results,

1667048741581.png
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I didn't get your setup exactly but usually multiple criteria search is like this:
=INDEX(yourindexcolumn,MATCH(1,((firstcriteriarange)=firstcriteria)*((secondcriteriarange)=secondcriteria),0))
This will lookup arrays so hitting Enter is not enough after paste.
Paste the formula and press Ctrl+Shift+Enter together.
 
Upvote 0
I didn't get your setup exactly but usually multiple criteria search is like this:
=INDEX(yourindexcolumn,MATCH(1,((firstcriteriarange)=firstcriteria)*((secondcriteriarange)=secondcriteria),0))
This will lookup arrays so hitting Enter is not enough after paste.
Paste the formula and press Ctrl+Shift+Enter together.
Hi Flashbond, I am trying to generate the list of maximum occurrences (mode) of a column but with multiple conditions.

What I am trying is similar to this page: Excel formula: Most frequent text with criteria | Exceljet but with multiple criteria.
 
Upvote 0
I am not familiar to use MODE function with IF.
If I were you I would modify first formula like this: ...IF(('Rawdata'!AF:AF='Dashboard'!E5)*('Rawdata'!AI:AI='Dashboard'!B10),MATCH...
Also use this with Ctrl+Shift+Enter.
 
Upvote 0
I am not familiar to use MODE function with IF.
If I were you I would modify first formula like this: ...IF(('Rawdata'!AF:AF='Dashboard'!E5)*('Rawdata'!AI:AI='Dashboard'!B10),MATCH...
Also use this with Ctrl+Shift+Enter.
Hi Flashbond, Thank you for your advice but it still does not solve my inquiry
 
Upvote 0
Hi,

Maybe someone will answer the question. But I am personally eager to try by my self. It would be great if you can provide a sample file. I want to work on it.
And please tell me which data you want to match most and what are the two criterias?
 
Upvote 0
Hi Flashbond, Thank you for trying to help me. This is my sample file

What I am trying to do is to get the name (the answer should be either: "male", "female" or "prefer not to say") of the most occurring gender that has the most resignations last 2022 and its location is labeled as "Contractors" Please see sample file for your reference. Thanks

1. Dashboard File

Attrition Rate Report.xlsx
ABC
22Gender with Most ResignationsFemale
23Position with Most ResignationsESG and Responsible Investment Advisory
24Department with most ResignationsSales
25Division with most ResignationsSales & Marketing
Dashboard
Cell Formulas
RangeFormula
C22C22=INDEX('RawData&Functions'!S:S, MODE(IF('RawData&Functions'!AH:AH=Dashboard!B10,IF('RawData&Functions'!AE:AE=Dashboard!E5, MATCH(1,('RawData&Functions'!AE:AE=Dashboard!E5)*('RawData&Functions'!AH:AH=Dashboard!B10),0),""))))
C23C23=INDEX('RawData&Functions'!AB:AB, MODE(IF('RawData&Functions'!AH:AH=Dashboard!B10,IF('RawData&Functions'!AE:AE=Dashboard!E5, MATCH(1,('RawData&Functions'!AE:AE=Dashboard!E5)*('RawData&Functions'!AH:AH=Dashboard!B10),0),""))))
C24C24=INDEX('RawData&Functions'!AD:AD, MODE(IF('RawData&Functions'!AH:AH=Dashboard!B10,IF('RawData&Functions'!AE:AE=Dashboard!E5, MATCH(1,('RawData&Functions'!AE:AE=Dashboard!E5)*('RawData&Functions'!AH:AH=Dashboard!B10),0),""))))
C25C25=INDEX('RawData&Functions'!AC:AC, MODE(IF('RawData&Functions'!AH:AH=Dashboard!B10,IF('RawData&Functions'!AE:AE=Dashboard!E5, MATCH(1,('RawData&Functions'!AE:AE=Dashboard!E5)*('RawData&Functions'!AH:AH=Dashboard!B10),0),""))))
Press CTRL+SHIFT+ENTER to enter array formulas.


And this is my Raw Data

Cell Formulas
RangeFormula
S5:S10S5=TRIM(E5)
T5:T10T5=DATEVALUE(TRIM(TEXT(F5,"MMMM DD, YYYY")))
U5:U10U5=IFERROR(DATEVALUE(TRIM(TEXT(G5,"MMMM DD, YYYY"))),"")
V5:V10V5=DATEVALUE(TRIM(TEXT(K5,"MMMM DD, YYYY")))
W5:W10W5=IFERROR(DATEVALUE(TRIM(TEXT(L5,"MMMM DD, YYYY"))),"")
X5:X10X5=IF(AND(T5<>"",U5<>""),"Yes","No")
Y5:Y10Y5=IF(X5="No","",NUMBERVALUE(CONVERT(U5-T5,"day","yr")))
Z5:Z10Z5=IF(X5="No",NUMBERVALUE(CONVERT(TODAY()-T5,"day","yr")),"")
AA5:AA10AA5=IF(Z5<>"",TRUNC(NUMBERVALUE(Z5)),TRUNC(NUMBERVALUE(Y5)))
AB5:AB10AB5=TRIM(J5)
AC5:AC10AC5=IF(ISNUMBER(SEARCH({"Not in Use"},M5)), TRIM(TEXTBEFORE(TEXTAFTER(M5,"(",-1,0),")",1,0)),TRIM(M5))
AD5:AD10AD5=IF(ISNUMBER(SEARCH("Not in Use",N5)), TRIM(TEXTBEFORE(TEXTAFTER(N5,"(",-1,0),")",1,0)), IF(N5="N/A",TRIM(AC5),TRIM(N5)))
AE5:AE10AE5=TRIM(TEXTAFTER(O5,",",-1,0,1))
AF5:AF10AF5=NUMBERVALUE(TEXT(T5,"YYYY"))
AG5:AG10AG5=TEXT(T5,"MMMM")
 
Upvote 0
I think you have a country name in Dashboard!E5. Thats OK. What kind of information do you have in Dashboard!B10 and Rawdata!AH?
 
Last edited by a moderator:
Upvote 0
I think my second suggestion in post#4 was correct. This works for me:
Excel Formula:
=INDEX(returnRange,MODE(IF((firstCriteriaRange=firstCriteria)*(secondCriteriaRange=secondCriteria),MATCH(returnRange,retunRange,0))))
Of course, this is an array function.
 
Upvote 0
Untested theory
Excel Formula:
=LET(r,UNIQUE(returnRange),c,COUNTIFS(firstCriteriaRange,firstCriteria,secondCriteriaRange,secondCriteria,returnRange,r),LOOKUP(MAX(c),c,r))
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,799
Members
449,095
Latest member
m_smith_solihull

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