Two types of Data Validation in a cell?

L

Lakeville

I want to ensure that the data in a cell is either a capitalized Y or a
capitalized N. I understand how to do the data validation of a list with Y &
N. And I understand how to enforce capitalization: =EXACT(A1,UPPER(A1)).
However, I don't understand how to enforce both for the same cell.
 
B

Basil

You could just select the 'List' option and type Y,N in the criteria. It is
case sensitive.
 
R

ryguy7272

Data > Valivation > List > Source = =$B$1:$B$2
In Cell B1, put Y and in Cell B2, put N
 
T

T. Valko

Try this...

=FIND(A1,"~YN")>1

Or, the robust version:

=FIND(A1,UPPER("~YN"))>1
 
L

Lakeville

I thought it was case sensitive, but it is not working that way for me.

:
You could just select the 'List' option and type Y,N in the criteria. It is
case sensitive.
 
L

Lakeville

This is what I already have. If the user uses the drop down to select Y or N,
then it works properly. However, a user can manually enter lowercase y or n,
and I want to avoid that.
 
B

Basil

Strange. It would only stop them from entering the text once they navigate
away from the cell, and only if 'Show error alert after invalid data is
entered' is checked in the Error Alert tab of the Data Validation menu form.

Biff's solution should work too.
 
T

Teethless mama

Or, the robust version:
=FIND(A1,UPPER("~YN"))>1

your formula fail. If user enter both YN in a cell


Try this one:

=AND(EXACT(A1,UPPER(A1)),OR(A1="Y",A1="N"))
 
T

T. Valko

=FIND(A1,UPPER("~YN"))>1
your formula fail. If user enter both YN in a cell

Good catch. I didn't test for that possibility.

Try this one:

=(LEN(A1)=1)*(FIND(A1,UPPER("YN")))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top