Dynamically listing results from an array?

hitdave85

New Member
Joined
Jun 11, 2013
Messages
30
Hello,

On the tab 'Sheet1', I have the following table:

[TABLE="class: grid, width: 250"]
<tbody>[TR]
[TD]New York
[/TD]
[TD]Yes
[/TD]
[/TR]
[TR]
[TD]California
[/TD]
[TD]No
[/TD]
[/TR]
[TR]
[TD]Alabama
[/TD]
[TD]No
[/TD]
[/TR]
[TR]
[TD]Texas
[/TD]
[TD]Yes
[/TD]
[/TR]
</tbody>[/TABLE]

On the tab 'Sheet2', I would like to only list the states with a 'Yes' from this table. In other words, is it possible via formulas to dynamically list those states on another tab based on my 'Yes' criteria? By dynamic, I mean that I can add more states to my table on 'Sheet1' and the 'Yes' states will automatically populate in a convenient list on a tab on 'Sheet2'? I know VBA can do this, but I'm curious if this can be done via formulas. Any ideas?

Thanks!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
On sheet1


Excel 2013/2016
AB
1StateYes/No
2New YorkYes
3CaliforniaNo
4AlabamaNo
5TexasYes
Sheet1


And sheet 2

Excel 2013/2016
A
1States
2New York
3Texas
Sheet2
Cell Formulas
RangeFormula
A2{=IFERROR(INDEX(Sheet1!A$2:A$100,SMALL(IF(Sheet1!B$2:B$100="Yes",ROW(Sheet1!$A$2:$A$100)-ROW(Sheet1!$A$2)+1),ROWS($1:1))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.

Copied down as far as needed
 
Upvote 0
Awesome! Very cool. Is it possible to include additional criteria to 'Yes'? For example, instead of Yes/No, what if I have Yes/No/Maybe and I want to list only the states with either Yes or Maybe.
 
Upvote 0
Try
=IFERROR(INDEX(Sheet1!A$2:A$100,SMALL(IF((Sheet1!B$2:B$100="Yes")+(Sheet1!B$2:B$100="Maybe"),ROW(Sheet1!$A$2:$A$100)-ROW(Sheet1!$A$2)+1),ROWS($1:1))),"")
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,899
Messages
6,181,627
Members
453,058
Latest member
rmd0725

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