How to Calculate Product Quantities from a Total Value in Excel
Question details
The user needs to determine the individual quantities of four products with fixed prices that add up to a specific, changing total value.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Reverse-calculating unknown product quantities based on known fixed prices and a known target total sales value.
- Observed behavior
- The user is unable to find a unique set of quantities because a single equation with four variables has multiple mathematical solutions without additional rules.
Ensure you have the Solver add-in enabled in your spreadsheet, as calculating multiple variable quantities to meet a target total requires advanced optimization tools. Identify any business constraints beforehand, such as minimum order quantities or inventory limits.
Use the Solver Tool with Integer Constraints
Since one equation with four variables has multiple answers, the Solver tool can find the best combination of quantities based on constraints like requiring whole numbers.
Mathematically, finding four unknown quantities from a single total value requires additional rules. The Solver add-in allows you to define a target total and ask the software to adjust the four quantity cells until that total is reached, adhering to constraints like 'must be a positive integer'.
Go to File > Options > Add-ins. At the bottom of the window, ensure 'Excel Add-ins' is selected in the Manage box, and click Go. Check the box for 'Solver Add-in' and click OK.
Create a table with columns for 'Price', 'Quantity' (enter 1 in each as a placeholder), and 'Total per Product' (formula: Price * Quantity). Calculate the 'Grand Total' using the SUM function on the 'Total per Product' column.
Navigate to the Data tab on the top ribbon and click on 'Solver' in the Analyze group.
Set the 'Set Objective' field to your Grand Total cell. Choose 'Value of' and type your desired target total into the box.
Set 'By Changing Variable Cells' to your four placeholder Quantity cells. Click 'Add' to create constraints specifying that these cells must be 'int' (integers) and >= 0. Click 'Solve' to let Excel find the matching quantities.

Use Basic SUM Functions for Simple Addition
If the goal is simply to add the fixed prices of the four products to see their combined value, a basic SUM formula is sufficient without using advanced add-ins.
Use WPS Spreadsheet to Calculate Target Values
WPS Spreadsheet includes powerful data analysis tools like Goal Seek and Solver built-in, allowing you to easily calculate variable quantities to meet a specific total without complex manual math.
- 1. Input your data: Open WPS Spreadsheet and input your fixed prices and placeholder quantities in adjacent columns.
- 2. Calculate the grand total: Calculate the grand total in a dedicated cell using the formula =SUMPRODUCT(Prices_Range, Quantities_Range).
- 3. Open Solver: Go to the Data tab on the ribbon and select 'Solver' to open the parameter configuration dialog.
- 4. Set parameters and solve: Define your target total value, set the changing cells to your quantities, add integer constraints, and click Solve.

Frequently Asked Questions
Why can't Excel just give me the quantities automatically?
A single total value made up of four variables can have many different mathematical combinations. Without specific constraints (like setting a minimum quantity or requiring whole numbers), Excel cannot determine which specific combination you are looking for.
What is Goal Seek, and can I use it for this problem?
Goal Seek is a What-If Analysis tool used to find the result of one variable when you know the desired outcome. Because your problem has four unknown variables (quantities for four distinct products), Goal Seek is insufficient and you must use the Solver tool instead.
How do I force the Solver to only give me whole numbers?
In the Solver Parameters dialog box, click 'Add' under the Constraints section. Select your quantity cells, choose 'int' (integer) from the middle dropdown menu, and click OK. This forces the solution to only use whole numbers.
Does the Solver add-in cost extra?
No, the Solver add-in is a free, built-in feature included in both Microsoft Excel and WPS Spreadsheet, though it generally needs to be manually enabled in the Add-ins settings menu before first use.




