Data Validation

markster

Well-known Member
Joined
May 23, 2002
Messages
579
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello

Basically, I have column and I want people to enter letters with a comma after each letter so they might enter ABC they would be forced to enter it as A,B,C or CDEF forced to enter as C,D,E,F

I looked at data validation but can't see an option to do something like this. I'm sure there must be - any ideas?

Thanks,
Mark
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
You could process whatever they put in - like this:
Mr Excel Playground 3.xlsm
J
13ABC
14A,B,C
Sheet17
Cell Formulas
RangeFormula
J14J14=TEXTJOIN(",",TRUE,MID(J13,SEQUENCE(LEN(J13)),1))
 
Upvote 0
You can use data validation & use Custom with this formula
Excel Formula:
=LEN(F10)-LEN(SUBSTITUTE(F10,",",""))+1=INT(LEN(F10)/2)+1
Change the F10 to the cell with the DV
 
Upvote 0
You can use data validation & use Custom with this formula
Excel Formula:
=LEN(F10)-LEN(SUBSTITUTE(F10,",",""))+1=INT(LEN(F10)/2)+1
Change the F10 to the cell with the DV
That would allow, for example "A,,C" or "AC,"
 
Upvote 0
That's a very good point. Hadn't thought of that. :(
 
Upvote 0
Perfect thanks guys - also I have another one where there needs to be a specific type of format this is different. For example they can enter a number range e.g. 1-5 or a single number such as 3 or a combination so they might enter 1-5,3,6-8 once again I what ever they enter needs to have a comma between entries as shown - could you help with this one too? Thanks
 
Upvote 0
I don't think that the computer can know the difference in intent between "1-5,3,6-8" and "1-53,6-8".
 
Upvote 0
Whilst still not perfect, that is better than my 1st attempt.
Excel Formula:
=LET(s,SEQUENCE(LEN(F10)/2,,,2),AND(MID(F10,s+1,1)=",",MID(F10,s,1)<>","))

I can see no way of doing your 2nd request.
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,094
Latest member
mystic19

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