04-17-2020 07:24 AM
04-17-2020 07:24 AM
I'm trying to limit what can be inserted in an excel cell. I want to limit the options to one or more six digit numbers separated by a comma and a space.
Examples of allowed entries:
123456, 123456, 123456
Examples of forbidden entries
I'm struggling to find the correct custom format for this.
04-18-2020 11:38 AMSolution
In general, what you're trying to do doesn't make sense from the perspective of sound spreadsheet design.
(A basic concept in spreadsheets and databases is that of "data integrity" Data integrity is what lies behind Excel's data validation--which is where I assume you're trying to do this in the first place--in that its goal is to limit entries to a certain format or set of values. The underlying reason for that is that you don't want to have the classic data processing problem of GIGO, "Garbage In, Garbage Out" You don't want people to enter something which would go through whatever downstream processes you have in mind, produce a result, and have that result be accepted when it shouldn't have ever gotten there.)
Now, by effectively muddying the waters here with what really are multiple "acceptable criteria" so far as the computer is concerned--they look distinct to you and me, because we are human and can see beneath the differences to a commonality--even if you and we could come up with a way to satisfy your original query, you might be opening yourself up to GIGO.
Better would be to accept only six digit entries. Full Stop. Perhaps have multiple rows of data, one for each entry of six digits...but kept distinct as entries. In the data validation screen there are two ways I see that you could allow only six digit entries. IF what you're looking for are numbers on which you're going to perform arithmetical processes, you can select "Whole Number" and then specify that it has to be between 1000000 and 999999. If, on the other hand, you're talking of serial numbers or the like, where it's really for all practical purposes text, then just select the entry that says "Text Length"