How do you restrict special characters in a cell?

awalker25

New Member
Joined
May 7, 2012
Messages
2
How do you restrict special characters ($, %, etc.) in excel? What is the formula for that?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Welcome to the board.

If you format a cell or range of cells for "number" (with no thousands separator), unprotect those cells and then use data validation to ensure that only positive whole numbers can be entered, then protect the worksheet ... that'll do it.

It's not that you can't even type the ,$.- etc., but they won't be held. All you'd be able to enter (and later view) would be positive whole numbers.

Something like that?
 
Upvote 0
Not exactly. I am trying to restrict users from enetering in "$" within a cell; however I am not sure of the formula for that!
 
Upvote 0
Not exactly. I am trying to restrict users from enetering in "$" within a cell; however I am not sure of the formula for that!
It might be easier to define what characters ARE ALLOWED as opposed to what characters are not allowed.

So, what characters are allowed?
 
Upvote 0
One way:
Excel Workbook
ABC
62as3asddf0TRUE
63as!asd#2FALSE
Sheet
#VALUE!


The Data Validation is the only formula you need, the others are there to show how it works. Invalid characters lumped together in a single string highlighted in bold blue above. You can add your own messages in Data Validation which (a) pop up in a yellow box when you select the cell and (b) a similar message to indicate why the entry was rejected.
 
Last edited:
Upvote 0
One way:
Excel Workbook
ABC
62as3asddf0TRUE
63as!asd#2FALSE
Sheet
#VALUE!


The Data Validation is the only formula you need, the others are there to show how it works. Invalid characters lumped together in a single string highlighted in bold blue above. You can add your own messages in Data Validation which (a) pop up in a yellow box when you select the cell and (b) a similar message to indicate why the entry was rejected.
mustr1.xlsx
AB
11234ABcdTRUE
2123 4AbcdFALSE
List1
Cell Formulas
RangeFormula
B1:B2B1=LEN(A1)-SUMPRODUCT(--(ISNUMBER(FIND(MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1),"/0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"))))=0
Named Ranges
NameRefers ToCells
_FilterDatabase=List1!$A$1:$A$1016B1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B1:B2Cell Value=FALSEtextNO


This is awesome p45cal,
I used it with a tweak to make it a stricter control - only allow listed characters.
Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,575
Messages
6,173,148
Members
452,502
Latest member
PQCurious

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