Forum Discussion

OwenO's avatar
OwenO
Copper Contributor
Apr 30, 2019
Solved

Some Excel help - Data validation using name ranges - force option if "False"

Hi I was looking for some help please. I have used a range 

 

=IF($N$28="True",$Q$3:$Q$4,IF($N$28="False",$Q$4))

 

this works fine, in that the O3 & O4 cells are just Yes/No selections.. 

 

this is being driven from 

 

=IF($C$22>=590,"True","False")

 

in my data validation I just use =<rangename>

 

however is there a way so that it forces the data validation to switch to "No" when No is the only option available.. By this I mean if they have populated a calculation sheet and being able to select the Yes option, if they then change the number and it falls below 590.. The field will still populate as "Yes" even though this isnt a valid option any longer... When you click the drop down it will only have "No" as the option, but is there a way to force it to switch to No if its below that 590 range??

 

hope this makes sense... 

  • can mark this as resolved.. had to use a VBA script which is something i just learned today

     

    for anyone it may potentially help who googled and found this however I've added what I used above

     

    you go into VBA (Alt+F11), choose the worksheet you want

     

    click the "change" option on the right side

     

    and add the code below:

    If Target.Address = "$C$4" Then
    Range("E28").Value = "Please Select..."

    End If

     

    (change the cell values to match the ones you need..)

5 Replies

  • OwenO 

    If I have understood your question correctly, the answer is that there is no way of forcing an input cell to switch to "No" if C22 is below that 590 range?  It is possible to build the references to the data so that C22 is tested and if it is <590 the "Yes" is simply ignored and "No" is used

    = IF(C22<590, "No", UserInput)

     

    I would also observe that you appear to be going round in circles using "True"/"False" and "Yes"/"No" to represent the Boolean values TRUE/FALSE [or, alternatively, 1/0].  Using Boolean values your first formula reduces to

    = IF($N$28, $Q$3:$Q$4, $Q$4)

    whilst the next one is

    = $C$22>=590

     

    If you prefer 0/1 to FALSE/TRUE then the functions N() and SIGN() each convert Booleans to integers which allows custom number formatting.

    • OwenO's avatar
      OwenO
      Copper Contributor

      PeterBartholomew1 

       

      thanks for the reply, the reason I done the true and false is because if its 590 or over I want the user to have the ability to select Yes or No, but if under 590 then the cell to automatically update to No

       

      is this possible with the formula you referenced do you think?

       

       

      • PeterBartholomew1's avatar
        PeterBartholomew1
        Silver Contributor

        OwenO 

        Many things are possible, that does not necessarily mean they are a good idea.  It is only too easy to get caught out by one's own 'cleverness' at a later date!  Using Booleans rather than strings probably is a good idea but the number formatting within conditional formats is a step too far.

  • OwenO's avatar
    OwenO
    Copper Contributor

    can mark this as resolved.. had to use a VBA script which is something i just learned today

     

    for anyone it may potentially help who googled and found this however I've added what I used above

     

    you go into VBA (Alt+F11), choose the worksheet you want

     

    click the "change" option on the right side

     

    and add the code below:

    If Target.Address = "$C$4" Then
    Range("E28").Value = "Please Select..."

    End If

     

    (change the cell values to match the ones you need..)

Resources