Function Problems

Count a Three-Digit Range Such as 001-999 in Excel

Maira MehtabMaira Mehtab Nov 18, 2026 870 views

Question details

Determine how many endpoints or integers are represented by a range such as 001-999 in Excel.

Count a Three-Digit Range Such as 001-999 in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user wants to count a three-digit range without interpreting its hyphen as subtraction.
Observed behavior
The desired result is either two endpoints or 999 integers in the inclusive range, depending on what is being counted.
Before you start

Decide whether you want to count the two endpoints or every integer in the inclusive range. For a range in one cell, format the cell as Text before entering 001-999, or type an apostrophe first: '001-999.

Solution 1Recommended

Count all integers in a text range

Use this formula when A1 contains a hyphen-separated range and you need the inclusive count.

The formula assumes one hyphen separates two nonnegative integers and the lower endpoint comes first.

1
Enter the range as text

In cell A1, enter '001-999. The apostrophe tells Excel to store the value as text and is not displayed in the cell.

2
Calculate the inclusive count

In another cell, enter =VALUE(MID(A1,FIND("-",A1)+1,LEN(A1)))-VALUE(LEFT(A1,FIND("-",A1)-1))+1 and press Enter.

3
Check the result

For 001-999, the formula returns 999 because it includes both 1 and 999.

Count all integers in a text range
WPS Spreadsheets

Count a Three-Digit Range in WPS Spreadsheets

Use WPS Spreadsheets to store a hyphenated range as text, extract its endpoints, and calculate the inclusive count.

  1. 1. Open a spreadsheet: Launch WPS Office and open a workbook in Spreadsheets.
  2. 2. Enter the range: In cell A1, type '001-999 to store the range as text.
  3. 3. Enter the count formula: In another cell, enter =VALUE(MID(A1,FIND("-",A1)+1,LEN(A1)))-VALUE(LEFT(A1,FIND("-",A1)-1))+1 and press Enter.
  4. 4. Verify the count: Check that the formula returns 999 for the inclusive range 001-999.
Count every integer in a range such as 001-999.Preserve leading zeros by entering the range as text.Open and edit Microsoft Excel XLS and XLSX files.Use familiar spreadsheet formulas and controls.
microsoft office alternative - wps office

Frequently Asked Questions

Does 001-999 represent 2 values or 999 values?

It has two endpoints, but it represents 999 integers when counting every integer from 1 through 999, inclusive.

How do I keep Excel from treating the hyphen as subtraction?

Enter the range as text by typing '001-999 in the cell, or format the cell as Text before entering 001-999. Do not start the entry with an equals sign.

Why does the inclusive count formula add 1?

Subtracting the lower endpoint from the upper endpoint counts the gaps between them. Adding 1 includes both endpoints, so 999-1+1 returns 999.

How can I show leading zeros when the endpoints are in separate cells?

Select the endpoint cells, open Format Cells, and apply the custom number format 000. The cells remain numeric while displaying values such as 001.