Use PRODUCT with a Dynamic Number of Cells in Excel
Question details
Create a product formula that uses a count cell to determine how many values in a row to multiply.

- 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.
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.
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.
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.
Select an empty cell outside A1:J1 and enter =PRODUCT(A1:INDEX(A1:J1,1,L1)). Press Enter.
Edit L1 to select a different number of cells. For example, changing L1 to 5 extends the product through E1.

Use PRODUCT with OFFSET to Create a Dynamic Range
Use OFFSET when you want to specify the starting cell and the range width directly.
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. Open your workbook: Open WPS Spreadsheets and select File > Open to choose your workbook.
- 2. Enter the data and count: Place the values in A1:J1 and enter a whole number from 1 to 10 in L1.
- 3. Add the formula: Select an empty cell outside A1:J1, enter =PRODUCT(A1:INDEX(A1:J1,1,L1)), and press Enter.
- 4. Update the product: Change the count in L1 to include a different number of cells, then save the workbook using File > Save.

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.




