PDA

View Full Version : Solved: Two validation in one cell



sujittalukde
05-29-2007, 12:01 AM
Suppose cell A2 I want a drop down list via Data\validation\Allow\List say x,y,z At the same time another validation rule is needed if A1 is blank no entry can be made in A2 for which validation rule is Data\Validation\Allow\Custom =NOT(COUNTBLANK(A1))
How both these validation can be made??????????

Bob Phillips
05-29-2007, 12:49 AM
Maybe this will do it for you

=OR(AND(A1="",A2<>""),AND(A1<>"",OR(A2="x",A2="y",A2="z")))

mikerickson
05-29-2007, 01:00 AM
Use a dynamic range for the Validation list.

If your validation list came from cells Sheet1 C1:C10 (for example)

Define a name=MyList RefersTo: =OFFSET(Sheet1!$C$1,0,0,10,1).
Then incorperate a factor that varies with A1's emptyness.

myList = OFFSET(Sheet1!$C$1,0,0,10*(1-ISBLANK($A$1)),1)

When A1 is not blank, myList has 10 rows.
When A1 is blank, myList has 0 rows.

Set the Validation to List Source: =MyList

sujittalukde
05-29-2007, 10:06 PM
Dear xld, tested your formula in cell A2 Data\validation\aloow\custom but it restricts users to enter any data except x,y,z, in case cell A1 is not blank ie
1. if cell A1 is blank, any data can be entered in A2 whereas I need that if A1 is blank no any data cannot be entered in cell A2
2.If cell A1 is not blank then only x,y,z, can be entered. This is correct & confirm my needs.
Plz try something to fix problem1

sujittalukde
05-29-2007, 10:08 PM
Dear mikerickson, I could not understand your tips. Would u post a sample workbook?

mikerickson
05-29-2007, 10:34 PM
Get your data Validation from a dynamic named range. Define that range in such a way that it has no rows when A1 is blank.

Bob Phillips
05-30-2007, 12:27 AM
Change the formula to

=OR(AND(A1="",A2=""),AND(A1<>"",OR(A2="x",A2="y",A2="z")))

and uncheck the Ignore Blank checkbox.

sujittalukde
05-30-2007, 01:30 AM
Thanks xld, the formula is fully working.