Search : in
By :

Excel IF statement with Data Validation

Last answer on Aug 9, 2009 2:13:46 am BST Aronyo, on Aug 7, 2009 6:44:15 pm BST 
 Report this message to moderators

Hello,

I have a simple work book.
In B1, the data is limited (by Data Validation with a drop down List) to Yes and No.

I need to limit the range of data in D1 as, If A1 = Yes , then the value of D1 could be entered More or Equal to 51 ; and if A1 = No then the data entered into D1 should be Less than or Equals to 50

I prefer to do it with Data Validation. Anyone please help.

Configuration: Windows XP
Firefox 3.0.13

Best answers for « Excel IF statement with Data Validation » in :
Excel - IF formulas for Printing and Calculation ShowExcel - IF formulas for Printing and Calculation Issue Solution Note Issue I am trying to get Excel IF formulas to print a text and calculation based on true/false. Such as, if I have some dates, and I don’t need to send a notice to a...
Basic Excel Formulas ShowBasic Excel Formulas Below are some basic formulas for Microsoft excel: Basic formula : ADDITION cell A1 to A10 = sum (A1: A10) AVERAGE cell A1 to A10 = average (A1: A10) MAXIMUM cell A1 to A10 = max (A1: A10) MINIMUM...
[VBA: VB6] Using excel from another application Show[VBA: VB6] Using excel from another application Here is a little routine to call Excel from VB6 or another Office application. Paste in a general module (eg Module1) In VBA>> Insert>> Module and paste in the window ... In VB6>>...

1

 venkat1926, on Aug 9, 2009 2:13:46 am BST

I wondear wheher any quantitative condtion can be sued in validation.

however you can haae an event code which may solve your problem

You know how to create validation in A1 with "yes" or "no"

right click sheet tab and click view code
and in that window copy paste this event code

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$B$1" Then Exit Sub
If Target = "" Then Exit Sub
If Target.Offset(0, -1) = "yes" And Target < 51 Then

MsgBox "you should enter a number more than or equel to 51"
Target.Clear
End If
If Target.Offset(0, -1) = "no" And Target > 50 Then
MsgBox "you should enter number less than or equal to 50"
Target.Clear

End If

End Sub



now choose "yes" in A1 and type in B1 some number less than 51 see what happens.
similarly choose "no" for A1 and type in B1 some number more than 50 what happens

if the correct number is entered nothing will happen.

try.

Reply to venkat1926