multi criteria multi result lookup

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,053
Office Version
  1. 365
Platform
  1. Windows
trying to adapt https://www.get-digital-help.com/match-two-criteria-and-return-multiple-rows-in-excel/ to work for me. my version of the formula is:

=INDEX($AK$7:$AK$15, SMALL(IF(COUNTIF($AG$5,$AJ$7:$AJ$15)*COUNTIF($AG$6,$AJ$7:$AJ$15)*COUNTIF($AG$7,$AJ$7:$AJ$15), ROW($AJ$7:$AL$15)-MIN(ROW($AJ$7:$AL$15))+1), ROW(A7)), COLUMN(A7))

[TABLE="width: 432"]
<colgroup><col width="64" style="width: 48pt;" span="9"> <tbody>[TR]
[TD="width: 64, bgcolor: transparent"]AG5[/TD]
[TD="width: 64, bgcolor: #FFE699"]52MFD[/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AG6[/TD]
[TD="bgcolor: #FFE699"]444B3[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]AJ[/TD]
[TD="bgcolor: transparent"]AK[/TD]
[TD="bgcolor: transparent"]AL[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AG7[/TD]
[TD="bgcolor: #FFE699"]52MF[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]7[/TD]
[TD="bgcolor: #0070C0"]444B1[/TD]
[TD="bgcolor: #00B0F0"]John Done[/TD]
[TD="bgcolor: transparent"]10.00[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]#NUM![/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]8[/TD]
[TD="bgcolor: #0070C0"]444B1[/TD]
[TD="bgcolor: #00B0F0"]Paul Book[/TD]
[TD="bgcolor: transparent"]A/L[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]9[/TD]
[TD="bgcolor: #FFE699"]52MFD[/TD]
[TD="bgcolor: #00B0F0"]Sam Johnson[/TD]
[TD="bgcolor: transparent"]9.00[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[TD="bgcolor: #0070C0"]444B1[/TD]
[TD="bgcolor: #00B0F0"]Andrew Bloke[/TD]
[TD="bgcolor: transparent"]A/L[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]11[/TD]
[TD="bgcolor: #FFE699"]52MF[/TD]
[TD="bgcolor: #00B0F0"]Eric Fan[/TD]
[TD="bgcolor: transparent"]10.00[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]12[/TD]
[TD="bgcolor: #0070C0"]444B2[/TD]
[TD="bgcolor: #00B0F0"]Paul Peters[/TD]
[TD="bgcolor: transparent"]8.50[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]13[/TD]
[TD="bgcolor: #0070C0"]444B3[/TD]
[TD="bgcolor: #00B0F0"]John Sands[/TD]
[TD="bgcolor: #FFFFCC"]11.50[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]14[/TD]
[TD="bgcolor: #0070C0"]52MFD[/TD]
[TD="bgcolor: #00B0F0"]Guy Noob[/TD]
[TD="bgcolor: transparent"]9.00[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]15[/TD]
[TD="bgcolor: #0070C0"]444B1[/TD]
[TD="bgcolor: #00B0F0"]Old Mate[/TD]
[TD="bgcolor: transparent"]10.00[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]
I want to list each name for the three codes at left. what am I doing wrong?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Copy AM7 down.
Excel Workbook
AGAHAIAJAKALAM
552MFD
6444B3
752MF7444B1John Done10Sam Johnson
88444B1Paul BookA/LEric Fan
9952MFDSam Johnson9John Sands
1010444B1Andrew BlokeA/LGuy Noob
111152MFEric Fan10
1212444B2Paul Peters8.5
1313444B3John Sands11.5
141452MFDGuy Noob9
1515444B1Old Mate10
Sheet1
 
Upvote 0
so, I had the rows at the end wrong and my countif around the wrong way. why in these formulas does the countif layout differ to the normal coumtif? In this context, the criteria is placed before the range.

the fix above works perfectly; thank you. can it be further tweaked to list only those who did not have hours? for example, say eric fan and john sands had no hours this week. how would I adjust the formula to return only those two names?

I have just tried to add in another countif expression looking for null (blank) hours but it seems to skip the 4th argument, any ideas?
 
Last edited:
Upvote 0
so, I had the rows at the end wrong and my countif around the wrong way. why in these formulas does the countif layout differ to the normal coumtif? In this context, the criteria is placed before the range.

the fix above works perfectly; thank you. can it be further tweaked to list only those who did not have hours? for example, say eric fan and john sands had no hours this week. how would I adjust the formula to return only those two names?

I have just tried to add in another countif expression looking for null (blank) hours but it seems to skip the 4th argument, any ideas?
You are welcome - thanks for the reply. Just FYI, your formula also had the Countif's requiring an AND condition (Countif1*Countif2*Countif3) whereas it should be an OR condition (Countif1+Countif2+Countif3).

As for your new question, assuming that "A/L" in col AL indicates no hours this week, the formula can be adjusted as below.
Excel Workbook
AGAHAIAJAKALAM
552MFD
6444B3
752MF7444B1John Done10Eric Fan
88444B1Paul BookA/LJohn Sands
9952MFDSam Johnson9
1010444B1Andrew BlokeA/L
111152MFEric FanA/L
1212444B2Paul Peters8.5
1313444B3John SandsA/L
141452MFDGuy Noob9
1515444B1Old Mate10
Sheet1
 
  • Like
Reactions: ajm
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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