Function Problems

Excel: Generate Every Number Between Two Values

Huda QurayshiHuda Qurayshi Nov 12, 2026 868 views

Question details

The user needs to expand multiple beginning-and-ending number ranges into individual numbers automatically.

Product
Microsoft Excel or WPS Spreadsheet
Device & OS
not provided
Scenario
Telephone or other numeric ranges are stored with starting values in one column and ending values in another, and the user wants one generated number per row.
Observed behavior
The numbers must otherwise be entered manually instead of being spilled automatically from the supplied ranges.
Before you start

Place each range's beginning number in column B and ending number in column C, with one range per row. Confirm that every ending value is greater than or equal to its beginning value and that the output area is empty.

Solution 1Recommended

Use a dynamic array formula to expand all number ranges

Use this method in Microsoft 365, Excel for the web, or a compatible WPS Spreadsheet version when several beginning-and-ending ranges must become one continuous list.

The formula reads each beginning and ending pair from B2:C3, creates a sequence for every pair, combines the sequences, and spills the results into the cells below the formula. Change B2:C3 to match your source range.

For telephone numbers with leading zeros, format the output cells as Text or apply the required custom number format after generating the sequence.

1
Select the output cell

In Excel or WPS Spreadsheet, click the first empty cell where the expanded list should begin, such as E2.

2
Enter the range formula

Enter =DROP(REDUCE("",SEQUENCE(ROWS(B2:C3)),LAMBDA(x,y,VSTACK(x,SEQUENCE(INDEX(B2:C3,y,2)-INDEX(B2:C3,y,1)+1,1,INDEX(B2:C3,y,1),1)))),1) and press Enter.

3
Adjust the source range

Replace B2:C3 with the actual cells containing the beginning and ending numbers, keeping the beginning column first and the ending column second.

4
Review the spilled results

Check the cells below the formula to confirm that every value from each range appears once and that no existing content blocks the spill area.

Use a dynamic array formula to expand all number ranges
Example result: If B2:C3 contains 100–102 and 200–201, the formula returns 100, 101, 102, 200, and 201 in a single spilled list.

Expand Number Ranges Automatically in WPS Spreadsheet

WPS Spreadsheet can generate each number between supplied beginning and ending values with dynamic array formulas. Enter the range-expansion formula in an empty cell, update the source range, and let the results spill automatically without manual entry.

  1. 1. Open the spreadsheet: Open your XLSX or spreadsheet file in WPS Spreadsheet and confirm that the beginning and ending values are in adjacent columns.
  2. 2. Choose the output cell: Click an empty cell outside the source data, such as E2, where the generated list can spill downward.
  3. 3. Enter the expansion formula: Type =DROP(REDUCE("",SEQUENCE(ROWS(B2:C3)),LAMBDA(x,y,VSTACK(x,SEQUENCE(INDEX(B2:C3,y,2)-INDEX(B2:C3,y,1)+1,1,INDEX(B2:C3,y,1),1)))),1), then press Enter.
  4. 4. Update and verify the range: Change B2:C3 to the actual beginning-and-ending range, then confirm that the generated values fill the output area without spill conflicts.
Automatically expands multiple beginning-and-ending ranges into one usable list.Supports dynamic array formulas for fast spreadsheet data preparation.Provides a familiar interface for users moving from Excel.Compatible with Microsoft Excel XLSX files and common spreadsheet formats.
microsoft office alternative - wps office

Frequently Asked Questions

Which cells should the formula reference?

Use a two-column range in which the first column contains beginning values and the second contains ending values. For example, B2:C3 means beginnings are in B2:B3 and endings are in C2:C3.

Can this formula generate telephone numbers with leading zeros?

The formula generates numeric values, so leading zeros may not display automatically. Format the output cells as Text or use a custom number format with the required digit count.

What happens if an ending value is smaller than its beginning value?

The sequence length becomes invalid for that row and may produce an error. Correct the range so the ending value is equal to or greater than the beginning value.

Why do I get a spill or blocked-cell error?

The cells below or beside the formula may contain existing data. Clear the intended output area and ensure the formula is not inside a restricted table or merged-cell region.

Can I expand just one beginning-and-ending pair?

Yes. If the beginning value is in B2 and the ending value is in C2, enter =SEQUENCE(C2-B2+1,1,B2,1) in an empty cell to generate that single range.