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.

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"]EVENT[/TD]
[TD="align: center"]NAMES[/TD]
[TD="align: center"]TYPE[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]ABC[/TD]
[TD]HARD[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]CDE[/TD]
[TD]SOFT[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]EFG[/TD]
[TD]HARD[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]HIJ[/TD]
[TD]MED[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]KLM[/TD]
[TD]MED[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]NOP[/TD]
[TD]HARD[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]QRS[/TD]
[TD]HARD[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]TUV[/TD]
[TD]SOFT[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]WXY[/TD]
[TD]HARD[/TD]
[/TR]
</tbody>[/TABLE]

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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

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