ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Data Validation (https://www.excelbanter.com/excel-discussion-misc-queries/178279-data-validation.html)

k1ngr

Data Validation
 
How can I do Data Entry Validation for all the cells in a column.

I want to make sure all entries a
1. Exactly two characters long.
2. Are all upper case.
3. Are only alpha-characters.
4. Are not duplicated (no two cells contain the same sequence of two
characters).

Dick King

OssieMac

Data Validation
 
Hi Dick,

Select the column that you want to be validated.

Select Data-Validation (or Data-Data Validation if xl2007)

On Settings tab under Allow: Select custom

check the allow blank box.

Copy the following formula into the Formula box.

=AND(LEN(A1)=2,CODE(LEFT(A1,1))=65,CODE(LEFT(A1,1 ))<=90,CODE(RIGHT(A1,1))=65,CODE(RIGHT(A1,1))<=90 ,COUNTIF(A:A,A1)=1)

Note that the formula is one continuous line but will most likely be broken
with a line feed on this forum. You might have to copy it into Notepad and
remove the line feed. (I have not been able to edit them in the validation
formula box.) Also if your column is not column A then all the A1's plus A:A
in countif will have to be changed to your column.

Explanation:-
LEN(A1)=2 (ensures 2 characters long)
CODE(LEFT(A1,1))=65 and CODE(LEFT(A1,1))<=90 (ensures left character is
= uppercase A and <= to uppercase Z)


COUNTIF(A:A,A1)=1 (ensures only one entry in the column)


--
Regards,

OssieMac


"k1ngr" wrote:

How can I do Data Entry Validation for all the cells in a column.

I want to make sure all entries a
1. Exactly two characters long.
2. Are all upper case.
3. Are only alpha-characters.
4. Are not duplicated (no two cells contain the same sequence of two
characters).

Dick King


k1ngr

Data Validation
 
It worked great.

Thanks,
Dick

"OssieMac" wrote:

Hi Dick,

Select the column that you want to be validated.

Select Data-Validation (or Data-Data Validation if xl2007)

On Settings tab under Allow: Select custom

check the allow blank box.

Copy the following formula into the Formula box.

=AND(LEN(A1)=2,CODE(LEFT(A1,1))=65,CODE(LEFT(A1,1 ))<=90,CODE(RIGHT(A1,1))=65,CODE(RIGHT(A1,1))<=90 ,COUNTIF(A:A,A1)=1)

Note that the formula is one continuous line but will most likely be broken
with a line feed on this forum. You might have to copy it into Notepad and
remove the line feed. (I have not been able to edit them in the validation
formula box.) Also if your column is not column A then all the A1's plus A:A
in countif will have to be changed to your column.

Explanation:-
LEN(A1)=2 (ensures 2 characters long)
CODE(LEFT(A1,1))=65 and CODE(LEFT(A1,1))<=90 (ensures left character is
= uppercase A and <= to uppercase Z)


COUNTIF(A:A,A1)=1 (ensures only one entry in the column)


--
Regards,

OssieMac


"k1ngr" wrote:

How can I do Data Entry Validation for all the cells in a column.

I want to make sure all entries a
1. Exactly two characters long.
2. Are all upper case.
3. Are only alpha-characters.
4. Are not duplicated (no two cells contain the same sequence of two
characters).

Dick King



All times are GMT +1. The time now is 11:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com