Data Validation: Only allow comma or space(Alt+Enter) & Integer

dellzy

Board Regular
Joined
Apr 24, 2013
Messages
146
Hi,

I have a column for Case Number which is supposed to be integer only. But for some reasons, user sometimes need to enter more than 1 case number in a cell. At first, I set a rule in data validation to only allow integer to avoid user entering strings (unintentionally) but it becomes troublesome for the user when they just want to enter comma or at least press Alt+Enter to allow next line because the rule treats these as strings and restrict the entry. We cannot ask user to enter the extra case numbers in separate rows individually because it must be counted as 1 record of row when we do the pivot table for reporting purposes.

Is there any workaround, please?

Appreciate some help.

Thank you in advance.

DZ
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You can set up a data validation formula like this one, for numbers separated by comma.
=ISNUMBER(--SUBSTITUTE(A1,",",""))
 
Upvote 0
Hi konew1,

You can set up a data validation formula like this one, for numbers separated by comma.
=ISNUMBER(--SUBSTITUTE(A1,",",""))

Tq! It works! But can I enhance it to allow only max 8 digits for the case number before next comma, please?

Tq in advance.

DZ
 
Upvote 0
Here is one step towards where you want to be, but it has limitations.
=AND(ISNUMBER(--SUBSTITUTE(A1,",","")),IF(LEN(A1)>8,SEARCH(",",A1)< =9,FALSE))
It will only check the location of the first comma being < =9. It does not check the length of the second or subsequent case numbers.

If all case numbers must be exactly 8 digits then you could use MOD function, but that would allow one case number of 7 digits followed by another of 9 digits
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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