Data Validation Not Working

ANE0709

Board Regular
Joined
Feb 2, 2022
Messages
67
Office Version
  1. 365
Platform
  1. Windows
I am trying to add a data validation to A1-A20000 to exclude "-" and "-0" from being entered into any cell but it isnt working. Can someone please point me in the right direction? I have the Error Alert as well but that isnt triggering either.

1741362013218.png
 
How about
Excel Formula:
=ISERR(FIND("-",A1))
 
Upvote 0
Solution
How about
Excel Formula:
=ISERR(FIND("-",A1))
this worked. thank you :)

I had tried =iserror(find("-",A1)) previously but that didnt work either. Any idea why "iserr" would work but not "iserror"?
 
Upvote 0
You're welcome & thanks for the feedback.

ISERROR should work just as well
 
Upvote 0
this worked. thank you :)

I had tried =iserror(find("-",A1)) previously but that didnt work either. Any idea why "iserr" would work but not "iserror"?
The issue is the OR function, not ISERROR. Using OR in this case will return TRUE as long as one of the values is NOT in the cell. So, if the cell's value is "-", the OR logical formula will return TRUE (since it will not find "-0" and thus return an error), even though you would want a FALSE as this is one of the values you do not want in the cell.

In this particular case one value contains the other ("-" is in "-0"), so simply using FIND("-",A1) would work to catch any undesirable values.

See below. I created a different OR logical test that will work, but again, in this particular instance, the ISERROR(FIND("-", A1)) formula is what you would want to go with as it's simpler and does the same thing.

Book1
ABCDE
1Validation TextNew OR logical testOld OR logical testTesting for just "-"Testing for just "-0"
2"-0"FALSEFALSEFALSEFALSE
3-FALSETRUEFALSETRUE
4TextTRUETRUETRUETRUE
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=NOT(OR(ISNUMBER(FIND({"-0","-"},A2))))
C2:C4C2=ISERROR(OR(FIND("-",A2),FIND("-0",A2)))
D2:D4D2=ISERROR(FIND("-",A2))
E2:E4E2=ISERROR(FIND("-0",A2))
 
Upvote 0

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