Retricting Special Characters using Data Validation

MGupta1

New Member
Joined
Feb 14, 2018
Messages
3
Hi,

I have a requirement to restrict all the following special characters from being entered into a cell:

\/:%'*?<>|".

Have tried a few formulae but none worked in restricting all of them
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Enter the following data validation, if in A1

Code:
=AND(ISERROR(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"\/:%'*?<>|"".")))
 
Upvote 1
Hi, there is one small issue with this formula...it works fine when any of these special characters are added towards the end or mid of the cell, However it fails to restrict this special character when entered in the beginning: '
for example, if I enter ' towards end of say First Row Name, then the formula restricts. However if I put 'First Row Name then it takes '
What can be the modified formula to restrict this condition. Rest all works fine.

Thanks
 
Upvote 0
Hi, there is one small issue with this formula...it works fine when any of these special characters are added towards the end or mid of the cell, However it fails to restrict this special character when entered in the beginning: '
for example, if I enter ' towards end of say First Row Name, then the formula restricts. However if I put 'First Row Name then it takes '
What can be the modified formula to restrict this condition. Rest all works fine.

Thanks

the issue is not in the formula. Excel recognizes the single apostrophe as being a special character which tells Excel to treat the rest of the string as text. Maybe you can deactivate this setting, try to google it
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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