简体   繁体   English

根据Excel下拉列表中的选择填充整个列

[英]Populate an entire column based off selection from a drop down list in excel

I created a drop-down list through data validation of the 50 states. 我通过对50个州的数据验证创建了一个下拉列表。

I want to select a state from that drop-down and populate an entire separate column full of that states counties. 我想从该下拉列表中选择一个州,然后在整个单独的列中填充该州县。 I have a table on a separate worksheet that has columns "State" and "County" as A and B respectively. 我在一个单独的工作表上有一个表,该表的“州”和“县”列分别为A和B。 column A has the state name the entire length of the counties in column B. A列的州名称为B列的整个县的长度。

I have searched for about 2 hours through the internet and cannot seem to pinpoint one best way. 我已经在互联网上搜索了大约2个小时,似乎无法找到一种最佳方法。 Any help would be great 任何帮助都会很棒

Column A contains the states. Column A包含状态。 Column C and D contains the states and the counties respectively. Column CD Column C分别包含州和县。

Cell F1 has data validation drop down for the range $A$1:$A$14 . 单元格F1数据验证范围$A$1:$A$14 Enter the formula in column G and drag down, or enter the formula for the entire column, 在G列中输入公式,然后向下拖动,或者为整列输入公式,

=IFERROR(INDEX(INDIRECT("C"&MATCH($F$1,C:C,0)+ROW()-ROW($1:$1)&":D999"),MATCH($F$1,INDIRECT("C"&MATCH($F$1,C:C,0)+ROW()-ROW($1:$1)&":C999"),0),2),"")

在此处输入图片说明

If you have the county names in a separate sheet modify the formula accordingly. 如果您在单独的表格中有县名,请相应地修改公式。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM