Return corresponding values based off of Data Validation List

imheadsup

New Member
Joined
May 23, 2018
Messages
13
Hello. I want to have a drop-down list with selections and based off of the selection in that list, other cells will populate the corresponding row values associated with that selection. For example, if I select Virginia, the table will return all data for that selection.

Raw data:
[TABLE="width: 591"]
<tbody>[TR]
[TD]State[/TD]
[TD]Universities[/TD]
[TD]Tuition[/TD]
[TD]City[/TD]
[TD]Student Population[/TD]
[/TR]
[TR]
[TD]Virginia[/TD]
[TD]Virginia Tech[/TD]
[TD="align: right"]$60,000 [/TD]
[TD]Blacksburg[/TD]
[TD="align: right"]1000[/TD]
[/TR]
[TR]
[TD]Virginia[/TD]
[TD]University of VA[/TD]
[TD="align: right"]$80,000 [/TD]
[TD] Charlottesville[/TD]
[TD="align: right"]2000[/TD]
[/TR]
[TR]
[TD]Virginia[/TD]
[TD]James Madison University[/TD]
[TD="align: right"]$40,000 [/TD]
[TD] Harrisonburg[/TD]
[TD="align: right"]3000[/TD]
[/TR]
[TR]
[TD]Maryland[/TD]
[TD]University of MD[/TD]
[TD="align: right"]$70,000 [/TD]
[TD] College Park[/TD]
[TD="align: right"]4000[/TD]
[/TR]
[TR]
[TD]Maryland[/TD]
[TD]Towson[/TD]
[TD="align: right"]$35,000 [/TD]
[TD] Baltimore[/TD]
[TD="align: right"]5000[/TD]
[/TR]
[TR]
[TD]North Carolina[/TD]
[TD]UNC[/TD]
[TD="align: right"]$60,000 [/TD]
[TD] Chapel Hill[/TD]
[TD="align: right"]6000[/TD]
[/TR]
[TR]
[TD]North Carolina[/TD]
[TD]Duke[/TD]
[TD="align: right"]$65,000 [/TD]
[TD]Durham[/TD]
[TD="align: right"]7000[/TD]
[/TR]
[TR]
[TD]North Carolina[/TD]
[TD]ECU[/TD]
[TD="align: right"]$55,000 [/TD]
[TD]Greenville[/TD]
[TD="align: right"]8000[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]



[TABLE="width: 591"]
<tbody>[TR]
[TD]Select State:[/TD]
[TD]Virginia (Drop down list)[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]State[/TD]
[TD]Universities[/TD]
[TD]Tuition[/TD]
[TD] City[/TD]
[TD]Student Population[/TD]
[/TR]
[TR]
[TD]Virginia[/TD]
[TD]Virginia Tech[/TD]
[TD="align: right"]$60,000 [/TD]
[TD] Blacksburg[/TD]
[TD="align: right"]1000[/TD]
[/TR]
[TR]
[TD]Virginia[/TD]
[TD]University of VA[/TD]
[TD="align: right"]$80,000 [/TD]
[TD] Charlottesville[/TD]
[TD="align: right"]2000[/TD]
[/TR]
[TR]
[TD]Virginia[/TD]
[TD]James Madison University[/TD]
[TD="align: right"]$40,000 [/TD]
[TD] Harrisonburg[/TD]
[TD="align: right"]3000[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Welcome to the forum.

This formula will extract all the matching records for all the fields for the Data Validation selection in I2.

Copy I5 across and down. You must copy down a sufficient number of rows to cover the number of matches there might be, a number shown in J2.


Book1
ABCDEFGHIJKLM
1StateUniversitiesTuitionCityStudent Population
2MarylandTowson$35,000Baltimore5000Select State:Virginia3
3VirginiaJames Madison University$40,000Harrisonburg3000
4North CarolinaECU$55,000Greenville8000StateUniversitiesTuitionCityStudent Population
5VirginiaVirginia Tech$60,000Blacksburg1000VirginiaJames Madison University40000Harrisonburg3000
6North CarolinaUNC$60,000Chapel Hill6000VirginiaVirginia Tech60000Blacksburg1000
7North CarolinaDuke$65,000Durham7000VirginiaUniversity of VA80000Charlottesville2000
8MarylandUniversity of MD$70,000College Park4000
9VirginiaUniversity of VA$80,000Charlottesville2000
Sheet73
Cell Formulas
RangeFormula
J2=COUNTIFS($A$2:$A$9,$I$2)
I5=IF($J$2>=ROWS($I$5:I5),INDEX(A$2:A$9,1/AGGREGATE(14,6,1/(($A$2:$A$9=$I$2)*(ROW($A$2:$A$9)-ROW($A$1))),IF($J$2>=ROWS($I$5:I5),ROWS($I$5:I5),""))),"")
 
Upvote 0
This worked perfectly. I just need to do a little manipulation to make it work exactly how I need it to for my table and I'll be set to go. Thank you.
 
Upvote 0
Question for you:

I'm having two problems with this now.

1. I have a counter, just like you said, but after about 30 rows of data, I'm getting a #num ! error. Any ideas why?

2. When I select the first value in my drop down list, all respective rows show up (with the exception of anything past row# 30). If I select any other values from my drop down list, the only the first corresponding row data is displayed.

Is there a way I can attach my file so you can see what's happening?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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