本文转自:http://*.com/questions/10657811/set-drop-down-values-based-on-vlookup
问:
I have a worksheet UserEntry
with 2 columns, Block
and Address
.
I want to validate both of these based on another worksheet Validation
with the same column names.
The data on the Validation
sheet is as follows:
Block | Address
---------------
001 | 101
001 | 101.3
001A | 35
020-1 | 203
020-1 | 203.5
020-1 | 204.1
...
答:
5down voteaccepted
|
You didn't mention VBA but here is a solution that uses it. Step 1Create a master table of Block-Address relationships. Make sure this is sorted on Cell Step 2Create a named range. The formula in
Step 3Set up a new worksheet (Sheet2) where the data entry will happen. Create data validation for the Step 4Open the VBA editor and paste this code in the module for
Step 5Enjoy. Your data validation is now context sensitive. Examples: |
答:
You can use a dynamic named range for this. Assumptions:
Create a Named Range to use as validation source (I've used name
Add Data Validation to the required cells: Allow
|