This is an old post, but I found a solution that will throw an error and prevent peeps from entering whatever they want (using Excel 2010), without using VBA.
In the user interface (SHEET1), I have the following fields:
- Field 1 is a yes / no validation drop-down list.
- Field 2 is a drop-down list of percent validation with values โโof 1% - 100%.
What I need:
When "Yes" is selected, I can select or enter 1% -100% in field 2. It is also "available."
When โNoโ is selected, field 2 becomes gray and the user can no longer enter any random value.
How I did it:
In field 2, I used conditional formatting (formula = 'SHEET2'! $ I $ 2 = "No") and set the font color and background color to gray.
In SHEET2, I set the field (column I) to field 1 from SHEET1, so it is either "Yes" or "No" depending on what is selected in field 1 from SHEET1. Then I just added 99 other lines below it, setting them equal to the cell directly above it. Therefore, I have 100 lines of โYesโ or โNoโ.
In SHEET2, I have another column (R) with the first cell value: = IF (I2 = "Yes", 0.01, 1)
Immediately below it, I: = IF (I3 = "Yes", R2 + 0.01, 1)
Then I pre-populate the values โโdown the lines below until I have 1% to 100% (when "Yes" is selected) and set the validation in the SHEET1 2 field based on these values. This allows me to manually enter the% value or select from the dropdown values โโfrom 1% to 100%.
Results:
When I select "No", it selects field 2 and leaves% of what it was before, because it cannot change the displayed value without VBA. For example, it can show 30%. However, if the user sees it in gray and tries to enter some value in it, for example 31%, it will cause an error, since I set ERROR on the "Error Warning" tab in the Data Validation for this field. If they choose a drop-down list, they just see 100 options at 100%. This is the only drawback, but I think that I could just close everything except one field showing 100%.
When I select "Yes", it discards field 2, and I am free to choose from the values โโof the list of additional orders between 1-100 again.
What do I need to do with the values:
For what I need to perform, I set some formula that I use based on 100% if "No" is selected and the field 2% if "Yes" is selected.
source share