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 Feb 22nd, 2002, 02:38 PM   #1
huorsa
Board Regular
 
Join Date: Feb 2002
Posts: 97
Default

I want to restrict the information that can be written in a range. Per example in A1, I want just numbers but no more than 10 characters and A2 I want alphanumeric but no more than 60 characters and also don't allow apecial characters like "," "%", "&".

Also if it is possible to show a message when you write a character not allowed.


Any ideas??????


Hugo
huorsa is offline   Reply With Quote
Old Feb 22nd, 2002, 06:14 PM   #2
Scott R
Board Regular
 
Join Date: Feb 2002
Location: WA state
Posts: 332
Default

For A1 use Data Validation, select "Custom" and enter this in "Formula":
=AND(ISNUMBER(A1),LEN(A1)<=10)

You can enter a message and/or error alert as well.

Determining whether an entry in A2 is alphanumeric is beyond me.
Scott R is offline   Reply With Quote
Old Feb 22nd, 2002, 06:46 PM   #3
Guest
 
Posts: n/a
Default

Quote:
On 2002-02-22 17:14, Scott R wrote:
For A1 use Data Validation, select "Custom" and enter this in "Formula":
=AND(ISNUMBER(A1),LEN(A1)<=10)

You can enter a message and/or error alert as well.

Determining whether an entry in A2 is alphanumeric is beyond me.
Scott:

Can you be more specific, I mean what is "data Validation" are you talking about excel?????

Hugo
  Reply With Quote
Old Feb 22nd, 2002, 07:10 PM   #4
Guest
 
Posts: n/a
Default

On your menu bar, click tools -> data validation. Select formula on the first of three tabs and enter the formula. The second tow tabs are the message prompts.

Cheers
  Reply With Quote
Old Feb 23rd, 2002, 02:34 AM   #5
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,314
Default

Quote:
On 2002-02-22 13:38, huorsa wrote:
I want to restrict the information that can be written in a range. Per example in A1, I want just numbers but no more than 10 characters and A2 I want alphanumeric but no more than 60 characters and also don't allow apecial characters like "," "%", "&".

Also if it is possible to show a message when you write a character not allowed.


Any ideas??????


Hugo
What is desired wrt A1 is easy (as Scott R noted), wrt A2 complicated in that it cannot be handled directly from within the Data Validation. In what follows I'll assume A1 and A2 to be points of data entry by users, say, in Sheet1.

Sheet1:

Activate A1;
Go to the Name Box on the Formula Bar, type an appropriate name, e.g., NumEntry, followed by enter.

Activate A2;
Go to the Name Box on the Formula Bar, type an appropriate name, e.g., AlphaNumEntry, followed by enter.

Insert a new worksheet or rename an existing empty worksheet BBoard (from Blackboard).

BBoard:

In B1 enter: Is NumEntry OK?
In B2 enter: Is AlphaNumEntry OK?

In C1 enter:

=AND(ISNUMBER(NumEntry),LEN(NumEntry)<=10)+0

Activate C1; Go to the Name Box on the Formula Bar, type NumEntryOK?, followed by enter.

In C2 enter:

=(SUMPRODUCT((ISNUMBER(MATCH(CODE(MID(UPPER(AlphaNumEntry),ROW(INDIRECT("1:"&LEN(AlphaNumEntry))),1)),{48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,8 6,87,88,89,90},0)))+0)=LEN(AlphaNumEntry))+0

Activate C2; Go to the Name Box on the Formula Bar, type AlphaNumEntryOK?, followed by enter.

Select C1:C2;
Activate Format|Cells;
On the Number tab, choose Custom;
Enter for Type:

[=0]"No";[=1]"Yes";General

Back to Sheet1:

Activate A1, the cell we named NumEntry;
Activate the option Data|Validation;
On the Settings tab, choose Custom for Allow;
Enter what follows in the Formula box:

=NumEntryOK?=1

Click OK.

Activate A2, the cell we named AlphaNumEntry;
Activate the option Data|Validation;
On the Settings tab, choose Custom for Allow;
Enter what follows in the Formula box:

=AlphaNumEntryOK?=1

Click OK.

In the last two steps, you have the choice to set up a message on the Alerts tab of the Data Validation Window to tell the user what you expect them to enter in the data entry cells.

Aladin
Aladin Akyurek 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 10:26 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