Data Validation to allow specific text entry and prevent other errors

sparky2205

Active Member
Joined
Feb 6, 2013
Messages
476
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to use Data Validation to achieve the following:
Allow n/a and a valid decimal value
Prevent text other than n/a and errors like; .23.23 where the user accidentally enters a second decimal point

I have the following formula which works fine when I use it directly on a spreadsheet:
Excel Formula:
=AND(ISERROR(FIND("N/A",UPPER(B9))),((LEN(B9)-LEN(SUBSTITUTE(B9,".","")))<>1))
i.e. n/a returns FALSE, 3.51 returns FALSE, .23.23 returns TRUE

However, when I transfer this to a Data Validation rule:
n/a triggers the rule, 3.51 triggers the rule, .23.23 doesn't trigger the rule. The exact opposite behaviour to that directly in the spreadsheet and to what I need.

Any thoughts?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
how about
=OR(ISNUMBER(A1),A1="N/A") - custom Data Validation rule

Book1
ABC
10.22
2
3.2.2FALSE
40.222TRUE
5N/aTRUE
6
Sheet1
Cell Formulas
RangeFormula
C3:C5C3=OR(ISNUMBER(A3),A3="N/A")
Cells with Data Validation
CellAllowCriteria
A1Custom=OR(ISNUMBER(A1),A1="N/A")
 
Upvote 0
Solution
doesnt for me
Book1
ABC
10.22
2
3.2.2FALSE
4.23.23FALSE
5N/aTRUE
6
Sheet1
Cell Formulas
RangeFormula
C3:C5C3=OR(ISNUMBER(A3),A3="N/A")
Cells with Data Validation
CellAllowCriteria
A1Custom=OR(ISNUMBER(A1),A1="N/A")
 

Attachments

  • Screenshot 2022-07-18 at 12.59.35.jpeg
    Screenshot 2022-07-18 at 12.59.35.jpeg
    206.2 KB · Views: 5
Upvote 0
Yep, don't know what I did the first time I tried it, but it's working fine now.
Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,834
Members
449,051
Latest member
excelquestion515

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