New Tool Radar

AI for Data & Spreadsheets

How to Restrict a Column to a Number Range With Excel Data Validation

Set a whole-number or decimal range with Excel data validation so quantities and discounts outside the range are blocked at entry.

Schematic with three steps: Choose Whole Number or Decimal; Set the range and the error message; Test values inside and outside the range.

A quantity of 0 or a discount of 110 percent usually means a typing slip, and it will flow into every total downstream. A number-range rule blocks the entry at the keyboard, with a message that says what the range is.

What you need

  • Excel with the entry column ready
  • The minimum and maximum values, agreed in advance
  • A note of whether decimals are allowed

Step 1: Choose Whole Number or Decimal

Select the entry cells and open Data, Data Tools, Data Validation. Choose Whole Number if only integers are valid, or Decimal if fractions are valid; a Whole Number rule rejects 0.15, so pick Decimal for percentages and rates.

Step 2: Set the range and the error message

Choose Between and enter the minimum and maximum, or point them at cells so a manager can change the limits without opening the dialog. On the Error Alert tab, write a message that states the allowed range.

Step 3: Test values inside and outside the range

Type a value inside the range, one below the minimum and one above the maximum. The inside value must be accepted and both outside values blocked; if any test fails, re-check whether you picked Whole Number or Decimal.

Worked example: synthetic quantity column, 1 to 500

The table below is a synthetic example. It shows the expected result of testing a number-range rule; no workbook was opened.

Entry tested In range 1-500? Result
250 Yes Accepted
0 No Blocked
501 No Blocked
120 Yes Accepted

Expected result (UNTESTED). 250 and 120 are accepted, while 0 and 501 are blocked by the error alert. The range rule works as intended. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A Decimal rule is needed for fractional values; a Whole Number rule rejects them.
  • Limits can be cell references, so a changed limit cell changes the rule everywhere.
  • Validation does not check values written by formulas, only values typed in.

Sources

See all