View Single Post
  #2  
Old March 23rd, 2011, 12:25 PM
tarquinious tarquinious is offline
Experienced Member
 
First recorded activity by OfficeFrustration: Mar 2011
Posts: 34
Default

Quote:
Originally Posted by narendran View Post
Dear Members,

I have two drop down list in the Excel sheet. say Country and State. If i choose value from Country, automatically respective state should be populated.
I have achieved this through creating the name manager and use that in the Data validation.

Issue here is, when i select the value from country, old value in the state still shows up in the field & correct value shows in the drop down. How to clear the old value in the state field ?

Can we achieve this through the excel sheet function itself without macros/scripts ? Appreciate your quick response.

Ps: am using Excel 2007
I have had this issue in the past when using Data Validation dropdowns populated using the INDIRECT function to look up named ranges. You can select a value from the first dropdown, the second dropdown is then populated with values so you select a value from the second, then change the first value. This should render the second option incorrect.

I was unable to clear the value functionally (it would be rather simple to do so with a macro), however I did use Conditional Formatting to highlight that the cell's value is no longer valid. I did this using a VLOOKUP in the Conditional Formatting formula wrapped in an ISERROR to change the colour of the text if it is no longer a member of the first dropdown's "family".

In this way perhaps you could colour the text white on a white background rendering it invisible and therefore the user thinks it has disappeared. Excel will still process it in formulas etc elsewhere though as it ignores colours and the value still exists.

The Conditional Formatting formula I used in cell C5 was:
=IF(C5"",IF(ISERROR(VLOOKUP($C5,INDIRECT($B5),1, 0)),1,0))
...where B5 held the first dropdown value and C5 the second dropdown value
NB: This forum often drops the "does not equal" signs in formula. If it isn't showing above, there is a greater-than/less-than between the first C5 and the double-quotes.

Last edited by tarquinious : March 23rd, 2011 at 02:24 PM. Reason: Forum drops the symbols