Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Richard H Knoff
 
Posts: n/a
Default Combining conditions for data entry validation

I need to create a validation rule that goes like this:
(1) Only accept values that start with the value in named cell
"Restrict"
(2) Do not accept values that contain a "?" (a question mark).

Example:
If the cell "Restrict" contains "abc", the cell with the validation
rule should accept "abc", "abcd", "abc123" etc, but not "abc?",
"abcd?", "aab" or anything else. If "Restrict" contains "a", the cell
should accept anything starting with "a", unless there's a "?"
involved.

This should be possible, shouldn't it??

Richard
  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi Richard
try
Cell A1 is your restirct cell and B1 the cell for which you want to
apply this validation

In the validation dialog enter
=(LEFT(B1,LEN(A1))=A1)*NOT(ISNUMBER(FIND("?",B1)))


--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
I need to create a validation rule that goes like this:
(1) Only accept values that start with the value in named cell
"Restrict"
(2) Do not accept values that contain a "?" (a question mark).

Example:
If the cell "Restrict" contains "abc", the cell with the validation
rule should accept "abc", "abcd", "abc123" etc, but not "abc?",
"abcd?", "aab" or anything else. If "Restrict" contains "a", the cell
should accept anything starting with "a", unless there's a "?"
involved.

This should be possible, shouldn't it??

Richard


  #3   Report Post  
Richard H Knoff
 
Posts: n/a
Default

Frank,
thanks a lot for your prompt reply.
I'm having problems, however, applying the validation rule. I get
a "formula error" message when I try to apply the rule to B1. I
also get the error message when I try to paste og type in part of
the rule, like
=LEFT(B1,LEN(A1))=A1 or
=NOT(ISNUMBER(FIND("?",B1))


But =ISNUMBER(A1) is accepted.

I've translated the formula terms to Norwegian, by the way.

Any ideas??

Regards,
Richard


"Frank Kabel" wrote in
:

Hi Richard
try
Cell A1 is your restirct cell and B1 the cell for which you want
to apply this validation

In the validation dialog enter
=(LEFT(B1,LEN(A1))=A1)*NOT(ISNUMBER(FIND("?",B1)))

--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
I need to create a validation rule that goes like this:
(1) Only accept values that start with the value in named cell
"Restrict"
(2) Do not accept values that contain a "?" (a question mark).

Example:
If the cell "Restrict" contains "abc", the cell with the
validation rule should accept "abc", "abcd", "abc123" etc, but
not "abc?", "abcd?", "aab" or anything else. If "Restrict"
contains "a", the cell should accept anything starting with
"a", unless there's a "?" involved.

This should be possible, shouldn't it??

Richard




  #4   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
are you using the semicolon as delimiter?. If yes replace the comas
with a semicolon

--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
Frank,
thanks a lot for your prompt reply.
I'm having problems, however, applying the validation rule. I get
a "formula error" message when I try to apply the rule to B1. I
also get the error message when I try to paste og type in part of
the rule, like
=LEFT(B1,LEN(A1))=A1 or
=NOT(ISNUMBER(FIND("?",B1))


But =ISNUMBER(A1) is accepted.

I've translated the formula terms to Norwegian, by the way.

Any ideas??

Regards,
Richard


"Frank Kabel" wrote in
:

Hi Richard
try
Cell A1 is your restirct cell and B1 the cell for which you want
to apply this validation

In the validation dialog enter
=(LEFT(B1,LEN(A1))=A1)*NOT(ISNUMBER(FIND("?",B1)))

--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
I need to create a validation rule that goes like this:
(1) Only accept values that start with the value in named cell
"Restrict"
(2) Do not accept values that contain a "?" (a question mark).

Example:
If the cell "Restrict" contains "abc", the cell with the
validation rule should accept "abc", "abcd", "abc123" etc, but
not "abc?", "abcd?", "aab" or anything else. If "Restrict"
contains "a", the cell should accept anything starting with
"a", unless there's a "?" involved.

This should be possible, shouldn't it??

Richard


  #5   Report Post  
Richard H Knoff
 
Posts: n/a
Default

Frank,
you were right, of course. I didn't notice the commas. The formula
is accepted now, and does exactly what I wanted. Thank you very
much!

Regards,
Richard


"Frank Kabel" wrote in
:

Hi
are you using the semicolon as delimiter?. If yes replace the
comas with a semicolon

--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
Frank,
thanks a lot for your prompt reply.
I'm having problems, however, applying the validation rule. I
get a "formula error" message when I try to apply the rule to
B1. I also get the error message when I try to paste og type in
part of the rule, like
=LEFT(B1,LEN(A1))=A1 or
=NOT(ISNUMBER(FIND("?",B1))


But =ISNUMBER(A1) is accepted.

I've translated the formula terms to Norwegian, by the way.

Any ideas??

Regards,
Richard


"Frank Kabel" wrote in
:

Hi Richard
try
Cell A1 is your restirct cell and B1 the cell for which you
want to apply this validation

In the validation dialog enter
=(LEFT(B1,LEN(A1))=A1)*NOT(ISNUMBER(FIND("?",B1)))



  #6   Report Post  
Max
 
Posts: n/a
Default

Try this slight adaptation of Frank's suggestion
which seems to work ok ..

To validate input in say B1,
set as the validation criteria:
Allow Custom
Formula:
=(LEFT(B1,LEN(Restrict))=Restrict)*ISERROR(FIND("? ",$B$1))

(you'd need to translate the formula to suit your language version)
--
Rgds
Max
xl 97
--
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
---
"Richard H Knoff" wrote in message
9...
Frank,
thanks a lot for your prompt reply.
I'm having problems, however, applying the validation rule. I get
a "formula error" message when I try to apply the rule to B1. I
also get the error message when I try to paste og type in part of
the rule, like
=LEFT(B1,LEN(A1))=A1 or
=NOT(ISNUMBER(FIND("?",B1))


But =ISNUMBER(A1) is accepted.

I've translated the formula terms to Norwegian, by the way.

Any ideas??

Regards,
Richard


"Frank Kabel" wrote in
:

Hi Richard
try
Cell A1 is your restirct cell and B1 the cell for which you want
to apply this validation

In the validation dialog enter
=(LEFT(B1,LEN(A1))=A1)*NOT(ISNUMBER(FIND("?",B1)))

--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
I need to create a validation rule that goes like this:
(1) Only accept values that start with the value in named cell
"Restrict"
(2) Do not accept values that contain a "?" (a question mark).

Example:
If the cell "Restrict" contains "abc", the cell with the
validation rule should accept "abc", "abcd", "abc123" etc, but
not "abc?", "abcd?", "aab" or anything else. If "Restrict"
contains "a", the cell should accept anything starting with
"a", unless there's a "?" involved.

This should be possible, shouldn't it??

Richard






  #7   Report Post  
Aladin Akyurek
 
Posts: n/a
Default


=MATCH(Restrict&"*",A1,0)*(1-ISNUMBER(SEARCH("~?",A1)))

where A1 is the cell you want to custom data validate and Restrict
refers to a cell which houses a value like "abc" or "a".

Richard H Knoff Wrote:
I need to create a validation rule that goes like this:
(1) Only accept values that start with the value in named cell
"Restrict"
(2) Do not accept values that contain a "?" (a question mark).

Example:
If the cell "Restrict" contains "abc", the cell with the validation
rule should accept "abc", "abcd", "abc123" etc, but not "abc?",
"abcd?", "aab" or anything else. If "Restrict" contains "a", the cell
should accept anything starting with "a", unless there's a "?"
involved.

This should be possible, shouldn't it??

Richard



--
Aladin Akyurek
------------------------------------------------------------------------
Aladin Akyurek's Profile: http://www.excelforum.com/member.php...fo&userid=4165
View this thread: http://www.excelforum.com/showthread...hreadid=278100

  #8   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
thanks for your feedback

--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
Frank,
you were right, of course. I didn't notice the commas. The formula
is accepted now, and does exactly what I wanted. Thank you very
much!

Regards,
Richard


"Frank Kabel" wrote in
:

Hi
are you using the semicolon as delimiter?. If yes replace the
comas with a semicolon

--
Regards
Frank Kabel
Frankfurt, Germany


Richard H Knoff wrote:
Frank,
thanks a lot for your prompt reply.
I'm having problems, however, applying the validation rule. I
get a "formula error" message when I try to apply the rule to
B1. I also get the error message when I try to paste og type in
part of the rule, like
=LEFT(B1,LEN(A1))=A1 or
=NOT(ISNUMBER(FIND("?",B1))


But =ISNUMBER(A1) is accepted.

I've translated the formula terms to Norwegian, by the way.

Any ideas??

Regards,
Richard


"Frank Kabel" wrote in
:

Hi Richard
try
Cell A1 is your restirct cell and B1 the cell for which you
want to apply this validation

In the validation dialog enter
=(LEFT(B1,LEN(A1))=A1)*NOT(ISNUMBER(FIND("?",B1)))

  #9   Report Post  
Richard H Knoff
 
Posts: n/a
Default

Aladin,
thank you! It appears there are several ways to accomplish this.

Regards,
Richard

Aladin Akyurek wrote
in :


=MATCH(Restrict&"*",A1,0)*(1-ISNUMBER(SEARCH("~?",A1)))

where A1 is the cell you want to custom data validate and
Restrict refers to a cell which houses a value like "abc" or
"a".

Richard H Knoff Wrote:
I need to create a validation rule that goes like this:
(1) Only accept values that start with the value in named cell
"Restrict"
(2) Do not accept values that contain a "?" (a question mark).

Example:
If the cell "Restrict" contains "abc", the cell with the
validation rule should accept "abc", "abcd", "abc123" etc, but
not "abc?", "abcd?", "aab" or anything else. If "Restrict"
contains "a", the cell should accept anything starting with
"a", unless there's a "?" involved.

This should be possible, shouldn't it??

Richard




  #10   Report Post  
Richard H Knoff
 
Posts: n/a
Default

Max,
this is a nice variation! Thank you!

Regards,
Richard

"Max" wrote in news:uYkhH8jyEHA.2572
@tk2msftngp13.phx.gbl:

Try this slight adaptation of Frank's suggestion
which seems to work ok ..

To validate input in say B1,
set as the validation criteria:
Allow Custom
Formula:
=(LEFT(B1,LEN(Restrict))=Restrict)*ISERROR(FIND("? ",$B$1))

(you'd need to translate the formula to suit your language version)




  #11   Report Post  
Max
 
Posts: n/a
Default

You're welcome, Richard !
Thanks for the feedback ..
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Richard H Knoff" wrote
Max,
this is a nice variation! Thank you!

Regards,
Richard



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation Window? Ken Excel Discussion (Misc queries) 1 January 11th 05 10:48 PM
Combining Defined Names to New Name For Validation TheSpankster22 Excel Worksheet Functions 1 November 8th 04 09:20 AM
Combining Defined Names to New Name For Validation TheSpankster22 Excel Worksheet Functions 0 November 4th 04 01:28 AM


All times are GMT +1. The time now is 04:15 AM.

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

About Us

"It's about Microsoft Excel"