Loading
Excel.Tips.Net ExcelTips (Menu Interface)

Limiting Entries to Numeric Values

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Limiting Entries to Numeric Values.

Gary has a worksheet that people in his office use for data entry. He wants to make sure that in a particular cell they can only enter a numeric value. He wonders how to stop them from entering other entries—like text or dates or times—in the cell.

The easiest way to do this is to use Excel's data validation feature. This feature allows you to define the parameters of what can be entered in a cell. Follow these steps:

  1. Select the cell you want used for inputting a value.
  2. Choose Validation from the Data menu. Excel displays the Settings tab of the Data Validation dialog box. (See Figure 1.)
  3. Figure 1. The Settings tab of the Data Validation dialog box.

  4. Using the Allow drop-down list, choose either Whole Number or Decimal, depending on which type of numeric input you want to allow. Excel changes the controls available in the dialog box.
  5. Using the Data drop-down list, make sure Between is selected.
  6. Enter in the Minimum and Maximum boxes the lower and upper bounds of what you want users to enter in the cell.
  7. On the other tabs of the dialog box, enter an input message and an error message, if desired.
  8. Click OK.

People can now enter only a numeric value within the range you specified. The one exception to this is dates and times. Since they are maintained internally, by Excel, as numbers, it is possible to enter a date, provided the date is parsed into a numeric value that is within the range you specify.

For instance, if you set up data validation to only allow values between 20,000 and 21,000, then someone could enter a date of 6/11/1956 because Excel parses the date to the whole number 20,617. The best way to handle dates and times is to format the cell so that it uses a numeric format, which will stop Excel from displaying dates and times.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2425) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Limiting Entries to Numeric Values.

Related Tips:

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

 

Leave your own comment:

*Name:
Email:
  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*Text:
*What is 5+3 (To prevent automated submissions and spam.)
 
 
           Commenting Terms

Comments for this tip:

Naveen N    14 Jul 2016, 07:09
Hi, This solution is creating the drop down list. which is very limited. where has i need to restrict the cell only for numeric entry it may be combination of any thing from 0 to 9 and the length of 6 only.

Please suggest me a way out.
karthik    22 Jun 2016, 07:14
I want to prevent the users to enter more than a specific value in a column..for example if i set 100 is the highest value for that cell, users can only enter less than 100.if they enter more than that error msg should popup.

I want to know how to set a high value for the cell and error popup option. can someone helpme....
Andy    19 Apr 2016, 15:25
This works for typing in values but not for copying/pasting values. I can set a field to numeric only like you say and can't type in anything but a number, but I can paste anything in there I want. Is there a fix for that?
Reddy    24 Oct 2015, 07:55
I am not sure if i can use data validation for this. I want restrict users from entering the following numbers in a range/cell - 10, 24, 35, 60, 70 and 80. How do i do this? Please advise
RIDDHI    18 Aug 2015, 07:32
@ Willy Vanhaelen

THANK YOU SO MUCH. THOUGH I COULD NOT UNDERSTAND LOGIC, BUT ITS WORKING. FANTASTIC.
Willy Vanhaelen    18 Aug 2015, 06:38
@riddhi,
Oops, I have been a little too hasty. The formula I proposed earlier will be true for i.e. 2A34B.

This formula will do a better job:
=AND(LEN(A1)=5,ISNUMBER(VALUE(MID(A1,3,2))),NOT(ISNUMBER(VALUE(LEFT(A1,1)))),NOT(ISNUMBER(VALUE(MID(A1,2,1)))),NOT(ISNUMBER(VALUE(RIGHT(A1,1)))))

The validation will accept any non-number for the first 2 and last characters such as A or B but also for i.e. a space or punctuation mark. If this is a problem then you'll need a user defined function because a classic formula would become extremely long.
Willy Vanhaelen    18 Aug 2015, 05:31
@riddhi,

This formula should do:

=AND(LEN(A1)=5,ISNUMBER(VALUE(MID(A1,3,2))),ISTEXT(LEFT(A1,2)&RIGHT(A1,1)))
riddhi    17 Aug 2015, 07:06
I have many codes which are in format of AB11A.(1st two and last letter alphabetic and, 3rd and 4th letter in numeric)

I want to make formula in such a way that excel doesnt accept number if any one type number in 1st, 2nd and 3rd position and it doest accept alphabetical if any one type in 3rd and 4th position.

In short in 1st,2nd and 5th place, excel accept only alphabecs and in 3rd and 4th it accept only numerical.
Azim     17 Oct 2014, 09:31
Hello sir

I have a query that is there any way that when i entered FIRST TIME anything in my cell, it will lock automatically LOCK so that no one can edit it and Delete it.
Surya    09 Aug 2014, 02:43
How to permit the user to enter either letter 'A' or a whole number between zero to sixty, in to a cell?
Abhinandan     11 Aug 2013, 09:40
Hello Sir,
I just subscribed you for excel.
I have a question. Please help me...

Is it possible to limit the data range depending upon value selected in drop down list.
Suppose i have a drop down list (say in cell M1)which has 5 options, namely Refrigerator, TV, Mixer, Micro oven, Speaker.
Now i want to limit the data entered in cell X20 depending upon the option selected.
For example:
For TV maximum value allowed to be entered in cell X20 = 1000$, For refrigerator 800 $ and so on....
Is it possible to do in excel 2010? If it is possible, tell me how to do it.
Thanks & Regards
Abhinandan     11 Aug 2013, 09:38
Is it possible to limit the data range depending upon value selected in drop down list.
Suppose i have a drop down list (say in cell M1)which has 5 options, namely Refrigerator, TV, Mixer, Micro oven, Speaker.
Now i want to limit the data entered in cell X20 depending upon the option selected.
For example:
For TV maximum value allowed to be entered in cell X20 = 1000$, For refrigerator 800 $ and so on....
Is it possible to do in excel 2010?
Thanks & Regards
 
 

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

 

Advertise with Us

Our Privacy Policy

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives

 

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.