A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

data validation



 
 
Thread Tools Display Modes
  #1  
Old June 10th, 2004, 08:53 PM
KK
external usenet poster
 
Posts: n/a
Default data validation

Hello,

I'm trying to use data validation to restrict the text allowed in a cell.

I want to allow the cell to contain any combination of 7 specified
characters. If the permitted characters are for example - a,b,c,d,e,f,g then
'a' is allowed, 'gddf' is allowed, 'gga' is allowed etc etc, but 'abx' is
forbidden. I can't use a list of permitted characters in the data validation
spec. because the number of combinations is huge. I might be able to use a
formula involving 'SUBSTITUTE' but it's messy.

Any ideas please?

Thanks

KK


  #2  
Old June 11th, 2004, 12:00 AM
Frank Kabel
external usenet poster
 
Posts: n/a
Default data validation

Hi
try using a formula like
=SUMPRODUCT(--(ISNUMBER(FIND({"a","e","g"},A1))))

in your data validation dialog


--
Regards
Frank Kabel
Frankfurt, Germany


KK wrote:
Hello,

I'm trying to use data validation to restrict the text allowed in a
cell.

I want to allow the cell to contain any combination of 7 specified
characters. If the permitted characters are for example -
a,b,c,d,e,f,g then 'a' is allowed, 'gddf' is allowed, 'gga' is
allowed etc etc, but 'abx' is forbidden. I can't use a list of
permitted characters in the data validation spec. because the number
of combinations is huge. I might be able to use a formula involving
'SUBSTITUTE' but it's messy.

Any ideas please?

Thanks

KK

  #3  
Old June 11th, 2004, 01:23 AM
Debra Dalgleish
external usenet poster
 
Posts: n/a
Default data validation

You could use Substitute, then check the length of the remaining string.
For example, with data validation in cell D4:


=LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(S UBSTITUTE(SUBSTITUTE(SUBSTITUTE(D4,"a",""),"b","") ,"c",""),"d",""),"e",""),"f",""),"g",""))=0

KK wrote:
I'm trying to use data validation to restrict the text allowed in a cell.

I want to allow the cell to contain any combination of 7 specified
characters. If the permitted characters are for example - a,b,c,d,e,f,g then
'a' is allowed, 'gddf' is allowed, 'gga' is allowed etc etc, but 'abx' is
forbidden. I can't use a list of permitted characters in the data validation
spec. because the number of combinations is huge. I might be able to use a
formula involving 'SUBSTITUTE' but it's messy.


--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #4  
Old June 11th, 2004, 07:50 AM
Leo Heuser
external usenet poster
 
Posts: n/a
Default data validation

Hello

In data validation for e.g. cell A1 try this formula:

=SUMPRODUCT(ISERROR(SEARCH(MID(A1,ROW(
INDIRECT("1:"&LEN(A1))),1),"abcdefg"))+0)=0

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"KK" skrev i en meddelelse
...
Hello,

I'm trying to use data validation to restrict the text allowed in a cell.

I want to allow the cell to contain any combination of 7 specified
characters. If the permitted characters are for example - a,b,c,d,e,f,g

then
'a' is allowed, 'gddf' is allowed, 'gga' is allowed etc etc, but 'abx' is
forbidden. I can't use a list of permitted characters in the data

validation
spec. because the number of combinations is huge. I might be able to use a
formula involving 'SUBSTITUTE' but it's messy.

Any ideas please?

Thanks

KK




  #5  
Old June 11th, 2004, 08:27 AM
Leo Heuser
external usenet poster
 
Posts: n/a
Default data validation

Addendum:

If the entry in A1 is case sensitive, use
FIND instead of SEARCH

LeoH

"Leo Heuser" skrev i en meddelelse
...
Hello

In data validation for e.g. cell A1 try this formula:

=SUMPRODUCT(ISERROR(SEARCH(MID(A1,ROW(
INDIRECT("1:"&LEN(A1))),1),"abcdefg"))+0)=0

--
Best Regards
Leo Heuser

Followup to newsgroup only please.



  #6  
Old June 11th, 2004, 08:32 AM
Leo Heuser
external usenet poster
 
Posts: n/a
Default data validation

Hi Frank

Array constants are not allowed in data validation.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Frank Kabel" skrev i en meddelelse
...
Hi
try using a formula like
=SUMPRODUCT(--(ISNUMBER(FIND({"a","e","g"},A1))))

in your data validation dialog


--
Regards
Frank Kabel
Frankfurt, Germany




  #7  
Old June 11th, 2004, 01:44 PM
Frank Kabel
external usenet poster
 
Posts: n/a
Default data validation

Hi Leo
thnaks for the info (should have tested this). for the OP
you may then use something like
=ISNUMBER(FIND("a",A1))ISNUMBER(FIND("b",A1))+ISNU MBER(FIND
("e",A1))

-----Original Message-----
Hi Frank

Array constants are not allowed in data validation.

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Frank Kabel" skrev i en

meddelelse
...
Hi
try using a formula like
=SUMPRODUCT(--(ISNUMBER(FIND({"a","e","g"},A1))))

in your data validation dialog


--
Regards
Frank Kabel
Frankfurt, Germany




.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.