Check for typing errors in cells

KyleG

Well-known Member
Joined
Jun 12, 2004
Messages
623
I am trying to find a way (macro) to ensure that the data in cells on a worksheet are correct.

The only data that will be entered are:
negative numbers eg. -1.40
Positive numbers eg. 1.40
Cells with the text n/a
Blank Cells.

We have had a few instances where people have accidently entered incorrect characters eg.
1..40
1.40.
n

All of these cause errors in formulas that are running on another worksheet. Is there a way that a have a macro check that only correct values are entered and gives the user a warning if they incorrectly type something?

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi,

My first idea would be to use data validation.
Choose "custom" and try this formula (while A1 is active): =OR(ISNUMBER(A1),A1="n/a")

You will only be able to fill in numerics or "n/a".
If you fill in the alertmessage, the user will be warned why the entry is not accepted. No code needed.

kind regards,
Erik
 
Upvote 0
Select that cell E9 here:

Excel Toolbar: Data - Validation..
Settings [Tab]

Allow:
Custom

Formula Is:

=Or(E9="n/a",E9="N/A",E9="",IsNumber(E9))
 
Upvote 0
Hi, Joe,

It works for me without repeating the string Lower & Upper Case.
Data validation is not casesensitive.

best regards,
Erik
 
Upvote 0
Thanks heaps thats exactly what i needed and no code required very cool.
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

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