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.

# Limiting Entries to Numeric Values

by Allen Wyatt
(last updated July 3, 2015)

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.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Need to easily adjust the vertical spacing that follows a paragraph? You can do it using dialog boxes or you can create ...

Discover More

Removing Spaces

Need to get rid of spaces in a range of cells? There are two ways you can approach the task, as described here.

Discover More

Cross-Referencing Index Entries

You've probably seen an index where an entry says something like 'Obsidian: See igneous rock.' This sort of ...

Discover More

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!

Using Data Validation

Want to control what users put into a cell? It's easy to do using a feature called data validation, as described in this tip.

Discover More

Single-Use Drop-Down List

Want to create an easy drop-down list? You can do so by using the data validation features of Excel.

Discover More

Limiting Input to a Format

When setting up a worksheet for others to use, you might want to make some limitations on what can be entered in certain ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 - 7?

2018-01-19 09:55:51

Hesley

I need to allow numbers only in some cells on a spreadsheet; however, I'm already using data validation on those cells with a formula, therefore I wonder if there is a solution other than data validation to restrict input to numbers only.
Macro is not an option, for the spreadsheet will be send to other people that may have not have macros enabled.
Thanks,

2018-01-19 09:33:10

Hesley

I need to allow numbers only in some cells on a spreadsheet; however, I'm already using data validation on those cells with a formula, therefore I wonder if there is a solution other than data validation to restrict input to numbers only.
Macro is not an option, for the spreadsheet will be send to other people that may have not have macros enabled.
Thanks,

2017-04-11 03:57:28

Mert

Hi Allen,

I see you didn't answer any question below but I'd appreciate. Is there a way to also lock cell to be deleted after I set data validation? If I lock cell, I can't enter any value, if I don't lock cell and only do data validation, then someone can delete the cell mistakenly which is unwanted in my case.

Thanks

2017-01-05 21:53:47

jamie ford

Hi Allen,
Is there a way to restrict the input to a cell to text?
I'm setting up a spreadsheet and want to restrict the type of entry in the cells.

Some are numeric and using validation works well for those cells.
Some are alpha and validation doesn't seem to work in the way I want.
When I validate the cell for text it lets me input numbers into the cell when I use it.

Some insights would be much appreciated.

Regards
Jamie

2016-11-01 14:58:26

Marc

Thank you.

2016-07-14 07:09:47

Naveen N

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.

2016-06-22 07:14:29

karthik

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....

2016-04-19 15:25:52

Andy

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?

2015-10-24 07:55:51

Reddy

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

2015-08-18 07:32:29

RIDDHI

@ Willy Vanhaelen

THANK YOU SO MUCH. THOUGH I COULD NOT UNDERSTAND LOGIC, BUT ITS WORKING. FANTASTIC.

2015-08-18 06:38:38

Willy Vanhaelen

@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.

2015-08-18 05:31:51

Willy Vanhaelen

@riddhi,

This formula should do:

=AND(LEN(A1)=5,ISNUMBER(VALUE(MID(A1,3,2))),ISTEXT(LEFT(A1,2)&RIGHT(A1,1)))

2015-08-17 07:06:07

riddhi

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.

2014-10-17 09:31:10

Azim

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.

2014-08-09 02:43:02

Surya

How to permit the user to enter either letter 'A' or a whole number between zero to sixty, in to a cell?

2013-08-11 09:40:25

Abhinandan

Hello Sir,
I just subscribed you for excel.

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

2013-08-11 09:38:14

Abhinandan

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

##### This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.