Data Validation for Alphanumeric and Hyphens (dashes) for a column

Status
Not open for further replies.

vakar4uk

New Member
Joined
Jan 5, 2023
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
Hello,

I'm trying to add Data Validation to 50 cells in a column that will only accept:
  1. Alphanumeric
  2. Hyphens (dashes)
No restrictions for length.
I did find some examples, but they are all for a single cell. If I try to change it to a range it breaks and won't let me save.
I tried this: =ISNUMBER(SUMPRODUCT(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-")))
Which works for cell A1. However, if I change A1 to anything else - it won't let me even save the formula. And I need a range instead - O2:O50.
Here is how I am trying to do it:
  1. Select a range of cells I need apply validation to, which O2:O50
  2. Click on Data Validation
  3. Select Custom Data validation and enter a formula above into the Formula entry.
1672939397722.png

Thank you so much in advance!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You just need the formula to reference O2.
You can also simplify it slightly like
Excel Formula:
=ISNUMBER(SUMPRODUCT(SEARCH(MID(UPPER(O2),SEQUENCE(,LEN(O2)),1),"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-")))
 
Upvote 0
Solution
You just need the formula to reference O2.
You can also simplify it slightly like
Excel Formula:
=ISNUMBER(SUMPRODUCT(SEARCH(MID(UPPER(O2),SEQUENCE(,LEN(O2)),1),"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-")))
Thank you!

And how would it apply it to the range O2:50? Or do you mean to select the range, then in the data validation enter that formula?

Thanks!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
You just need the formula to reference O2.
You can also simplify it slightly like
Excel Formula:
=ISNUMBER(SUMPRODUCT(SEARCH(MID(UPPER(O2),SEQUENCE(,LEN(O2)),1),"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-")))
Dear friend,
I came across this thread and found useful...but unfortunately I'm unable to use it...
1694415952461.png

I'm getting this error message.

Moreover I'm looking for character length restriction to 16. Only alphanumeric entries that contain both alphabets and numbers in the sequence AAAAXXXXXXXXXXXX where AAAA - alphabets (UPPERCASE) & XXXXXXXXXXXX - numbers (0-9).
Any help will be appreciated.
 
Upvote 0
Dear friend,
I came across this thread and found useful...but unfortunately I'm unable to use it...

I'm getting this error message.

Moreover I'm looking for character length restriction to 16. Only alphanumeric entries that contain both alphabets and numbers in the sequence AAAAXXXXXXXXXXXX where AAAA - alphabets (UPPERCASE) & XXXXXXXXXXXX - numbers (0-9).
Any help will be appreciated.

Duplicate to: Alphanumeric with Character Length Restriction
In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread. If you do not receive a response, you can "bump" it by replying to it yourself, though we advise you to wait 24 hours before doing so, and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,575
Messages
6,125,628
Members
449,240
Latest member
lynnfromHGT

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