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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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,215,339
Messages
6,124,363
Members
449,155
Latest member
ravioli44

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