• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Custom Data Validation to allow only specific characters and a specific length

riplen

New Member
Hi everybody,

I would like to make sure that if I do an input of a value in a specific cell there will be 2 data validations:
1. allow only specific characters
2. allow only a specific number of characters (length)

I've already setup following data validation (for the 1. point):

Custom formula:
=ISNUMBER(SUMPRODUCT(SEARCH("~"&MID(E2;ROW($1:$3000);1);"0123456789 abcdefghijklmnopqrstuvwxyz/-?: ().,'+")))
With an Error alert if there is a different input as specified:
Please use following characters:
(a-z, A-Z, 0-9, /-?: ().,'+Space)
This works perfectly.

Now I also would like to integrate a formula to restrict the number of characters (length in that cell (for example <= 70).

Has anybody an idea how to integrate this second conditions as a formula in my 1 formula above?

Thank you.

Riplen.
 
I would have thought, at first sight:
Code:
=AND(ISNUMBER(SUMPRODUCT(SEARCH("~"&MID(E2,ROW($1:$70),1),"0123456789 abcdefghijklmnopqrstuvwxyz/-?: ().,'+"))),LEN(E2)<70)
 
Back
Top