Extract values from range that match 2 criteria and return results in single cell

Dave_P_C

New Member
Joined
Nov 9, 2006
Messages
37
I have a table of around 1000 rows and 25 columns from which I want to query on 2 parameters and return the results in a single cell.

The table below is simplified to show what I am trying to achieve but essentially I am trying to create a query (without VBA if possible) that will lookup all the EVENTS of a given number with a TYPE of hard and return all the NAMES in a single cell. For example, the results of querying against EVENT=2 and TYPE=HARD would return ABC, NOP, WXY.

EVENTNAMESTYPE
2ABCHARD
2CDESOFT
1EFGHARD
3HIJMED
1KLMMED
2NOPHARD
3QRSHARD
2TUVSOFT
2WXYHARD

<tbody>
</tbody>

I have played around with TEXTJOIN and INDEX MATCH queries but not worked out a solution.

{=TEXTJOIN(", ",TRUE,IF(event=2,name,""))} works if I wanted to have all the EVENT 2 names but if I try to add a second filter for TYPE it does not work

{=TEXTJOIN(", ",TRUE,IF(event=2,IF(type="HARD",name,"")))}

Can this be achieved with TEXTJOIN or would it need some other query?

Thanks,
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Smaller set and I'm not sure how it would work with the larger data set but:


Book1
ABCDE
1EVENTNAMESTYPEABC,NOP,WXY
22ABCHARD
32CDESOFT
41EFGHARD
53HIJMED
61KLMMED
72NOPHARD
83QRSHARD
92TUVSOFT
102WXYHARD
Sheet1
Cell Formulas
RangeFormula
E1{=TEXTJOIN(",",TRUE,IF($A$2:$A$10=2,IF($C$2:$C$10="HARD",$B$2:$B$10,""),""))}
Press CTRL+SHIFT+ENTER to enter array formulas.


WBD
 
Upvote 0
Thank You WBD, :)

Your formula works on the larger data set as well.

I see part of the the issue with mine was trying to use names for ranges rather than cell / column references.
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,822
Members
449,190
Latest member
rscraig11

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