MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 29th, 2002, 08:56 AM   #1
Pisolippia
New Member
 
Join Date: Mar 2002
Location: ITALY
Posts: 16
Default

Hi all,
I wish I could have multiple Data Validation for one cell.
The conditions I need to check are :
- That the value entered is at least 2 digits long
- That its numeric value is less than the value of another cell (constant).
Depending on any of the two conditions I need to have different message boxes.
Thanks in advance for your kind advice.
Pisolippia is offline   Reply With Quote
Old Mar 29th, 2002, 09:00 AM   #2
lenze
MrExcel MVP
 
lenze's Avatar
 
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
Default

The first part is easy. Use the Custom Validation and the AND function. Something like =AND(Len(Cell)>1,Cell>RefCell). Getting two different messages is more challenging and prbably would best be done with the WorksheetChange Event.
lenze is offline   Reply With Quote
Old Mar 29th, 2002, 09:16 AM   #3
Pisolippia
New Member
 
Join Date: Mar 2002
Location: ITALY
Posts: 16
Default

Thanks for your quick answer.
Pisolippia is offline   Reply With Quote
Old Mar 29th, 2002, 09:18 AM   #4
Pisolippia
New Member
 
Join Date: Mar 2002
Location: ITALY
Posts: 16
Default

Thanks for your quick answer.
I still have problems using your formula when I enter values 01 to 09 in my cell.
They're converted to 1-9 and I get the error box.
Pisolippia is offline   Reply With Quote
Old Mar 29th, 2002, 09:21 AM   #5
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

Quote:
On 2002-03-29 08:18, Pisolippia wrote:
Thanks for your quick answer.
I still have problems using your formula when I enter values 01 to 09 in my cell.
They're converted to 1-9 and I get the error box.
Adjust lenze's formula to suit your situation:

=AND(LEN(Cell)>1,Cell+0
Aladin Akyurek is offline   Reply With Quote
Old Mar 29th, 2002, 09:30 AM   #6
Pisolippia
New Member
 
Join Date: Mar 2002
Location: ITALY
Posts: 16
Default

We're still not there.
Let try to explain better :
Input cell A1 has your suggested data validation formula :
AND(LEN(A1)>1,A1+0<$A$2)
Cell A2 has a constant value say 70
if I enter values in the range 10-69 they're
accepted.
If I enter values from 70 over I get the message box.
If I enter values from 01 to 09 (two digits) it looks they're missing the zero hence their length becomes < 2 and I get the message box which is not right.
Pisolippia is offline   Reply With Quote
Old Mar 29th, 2002, 09:32 AM   #7
lenze
MrExcel MVP
 
lenze's Avatar
 
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
Default

Format A1 as Text. The "+0" in Aladin's formula converts it back to a number
lenze is offline   Reply With Quote
Old Mar 29th, 2002, 09:37 AM   #8
Pisolippia
New Member
 
Join Date: Mar 2002
Location: ITALY
Posts: 16
Default

Great !
It works just as expected; will check again to see if someone has any ideas on how to get different message boxes for the same data validation.
Thanks and Happy Easter to you all.
Pisolippia is offline   Reply With Quote
Old Mar 29th, 2002, 09:46 AM   #9
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,318
Default

Quote:
On 2002-03-29 08:30, Pisolippia wrote:
We're still not there.
Let try to explain better :
Input cell A1 has your suggested data validation formula :
AND(LEN(A1)>1,A1+0<$A$2)
Cell A2 has a constant value say 70
if I enter values in the range 10-69 they're
accepted.
If I enter values from 70 over I get the message box.
If I enter values from 01 to 09 (two digits) it looks they're missing the zero hence their length becomes < 2 and I get the message box which is not right.
That's right.

If you insist entering the numbers as 01, 09, 11, etc., format A1 as Text. Then the formula

=AND(LEN(A1)>1,A1+0<$A$2)

will simply work.

If you format A1 as General, you can use a much simpler formula:

=A1
Aladin
Aladin Akyurek is offline   Reply With Quote
Old Mar 29th, 2002, 10:02 AM   #10
lenze
MrExcel MVP
 
lenze's Avatar
 
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
Default

Aladin is correct. If you must display the cells as 05,09,etc., then you can use Custom Formating '00' to display the leading zero for numbers less than 10. This will eliminate the LEN() part of the formula, reducing it to A1
[ This Message was edited by: lenze on 2002-03-29 09:02 ]

[ This Message was edited by: lenze on 2002-03-29 09:03 ]
lenze is offline   Reply With Quote
Reply

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:21 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes