Function Problems

Use PRODUCT with a Dynamic Number of Cells in Excel

Amos GikundaAmos Gikunda Nov 27, 2026 869 views

Question details

Create a product formula that uses a count cell to determine how many values in a row to multiply.

Use PRODUCT with a Dynamic Number of Cells in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A row contains values followed by a cell that specifies how many values to include in the calculation.
Observed behavior
The product should update automatically when the count changes.
Before you start

Identify the first value, the last cell in the available data range, and the cell containing the count. For the A1:J1 example, enter a whole-number count from 1 to 10 in L1 and place the formula outside A1:J1.

Solution 1Recommended

Use PRODUCT with INDEX to Set the Range Endpoint

Use this formula when the available values are in a known range and a separate cell controls how many to multiply.

1
Enter the values and count

Place the values in A1:J1 and enter the number of values to include in L1. For example, enter 4 to multiply the first four cells.

2
Enter the formula

Select an empty cell outside A1:J1 and enter =PRODUCT(A1:INDEX(A1:J1,1,L1)). Press Enter.

3
Change the count

Edit L1 to select a different number of cells. For example, changing L1 to 5 extends the product through E1.

Use PRODUCT with INDEX to Set the Range Endpoint
Keep the count within the range: Use a whole number from 1 to 10 for A1:J1. PRODUCT ignores blank cells and text in the referenced range.
Calculate in WPS Spreadsheets

Calculate a Dynamic Product in WPS Spreadsheets

Use PRODUCT and INDEX in WPS Spreadsheets to multiply a range that changes with a count cell.

  1. 1. Open your workbook: Open WPS Spreadsheets and select File > Open to choose your workbook.
  2. 2. Enter the data and count: Place the values in A1:J1 and enter a whole number from 1 to 10 in L1.
  3. 3. Add the formula: Select an empty cell outside A1:J1, enter =PRODUCT(A1:INDEX(A1:J1,1,L1)), and press Enter.
  4. 4. Update the product: Change the count in L1 to include a different number of cells, then save the workbook using File > Save.
Adjust the product by changing one count cellWork with Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and a familiar interfaceUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

What does the INDEX function do in the product formula?

In =PRODUCT(A1:INDEX(A1:J1,1,L1)), INDEX identifies the endpoint of the range. If L1 is 4, the range is A1:D1.

What happens if the count is greater than the available range?

For A1:J1, keep the count in L1 between 1 and 10. A count greater than 10 refers beyond the INDEX range and can produce an error.

Are blank cells included in the multiplication?

PRODUCT ignores blank cells and text in a referenced range. Numeric zero is included and makes the result zero.

Can I use the same formula in WPS Spreadsheets?

Yes. Open the workbook in WPS Spreadsheets and enter =PRODUCT(A1:INDEX(A1:J1,1,L1)) in an empty cell outside the data range.