I’m looking for an Excel formula that restricts to certain characters and length. It needs to be easily configurable as i need to apply it to specific columns/rows which have different data entry restrictions.
I’ve scoured many posts and the closest i came across was the below but the results seem very inconsistent during testing (for example this allows me to add a single asterisk which is outside the permitted characters).
=AND(LEN(A4)<=10,ISNUMBER(SUMPRODUCT(SEARCH(MID(A4,ROW(1:30),1),”ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_”))))
When i use the above, something weird seems to be going on with which rows this is applying to. I’m not sure if the mid section can be simplified as i don’t need to enter a row range if i can simply copy down the cell which automatically amends the cell references.
In simple terms, a formula where i can define a maximum length and a set of characters that i want to restrict data entry to.
Is anyone able to assist me please?
Many thanks.