Data Validation - Character Limit & Uppercase Only

JPhotonics

New Member
Joined
May 18, 2017
Messages
14
I am trying to set the character limit of my cells to 28 and force the characters to be uppercase using Data Validation so the user receives an error if either condition is not met.
I have the uppercase portion working fine, but cannot seem to get the length to function correctly. It seems Excel just ignores the length portion of my formula.

I know this can be done with VBA/Macro, but want to avoid if possible as there is other important VBA/Macro code part of the document which is owned by someone else.


Current situation:

Data Validation
Allow: Custom
Ignore Blank: Yes
Formula: =AND(EXACT(A2:A35,UPPER(A2:A35)),LEN(A2:A35)<=28)

AND(EXACT(A2:A35,UPPER(A2:A35)) - this portion appears to be functioning properly

Why can't I get the length to work? I have tried 28, <28, >28, <=28 nothing matters/works.
I tried LEFT and I also tried CONCATENATE. No dice.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
G'day JP,

Without knowing the cause, the problem seems to be with the range. I used your formula applied to a single cell and it worked for both the Upper Case and the Length.

Try applying the data validation to A2, then copying it down, which worked for me

Cheers

shane
 
Upvote 0
=AND(EXACT($A$2:$A$35,UPPER($A$2:$A$35)),LEN($A$2:$A$35)<=28)

worked for me...
 
Upvote 0
I am not sure why you need the ranges. A single cell should work too. Maybe due to possible row insertions?

If you post a link to an example file at a site like dropbox, we could troubleshoot.

Put =len(a2) in a cell and modufy a2. I did and it always worked. I typed A 28 times, enter and it was fine Another A and it errored as expected.
 
Upvote 0
I am not sure why you need the ranges. A single cell should work too. Maybe due to possible row insertions?

If you post a link to an example file at a site like dropbox, we could troubleshoot.

Put =len(a2) in a cell and modufy a2. I did and it always worked. I typed A 28 times, enter and it was fine Another A and it errored as expected.
I will try and upload when I get home, but figured this would be simpler! Haha

I tried the single cell (A2) way also. Still did not limit the character length in the cell, only uppercase.

Used:
=AND(EXACT(A2,UPPER(A2)),LEN(A2)<=28)
 
Upvote 0
Here is my simple example file. https://www.dropbox.com/s/8oixhcpzai3qyrf/UCASEandLEN.xlsx?dl=0

In A2, custom data validation formula is what you used in #6 .
=AND(EXACT(A2,UPPER(A2)),LEN(A2)<=28)
Holy crap do I feel like a dummy!
I tried it again and couldn't figure it out... I downloaded your file and had the same issue I was seeing. It worked for using alpha characters, but numbers would just turn into '111111+e10', etc.

The CELL FORMAT was General.
I changed the Cell Format to TEXT - voila!

It works with a single cell or range, I'll probably just set it once and use the range for simplicity. Thanks!
 
Upvote 0
Just to follow up, the code that worked was cell-specific, not for a range.

=AND(EXACT(A2,UPPER(A2)),LEN(A2)<=28)
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,525
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top