Calculation Issues

How to Calculate Product Quantities from a Total Value in Excel

Huma Ashraf ChHuma Ashraf Ch Nov 11, 2026 868 views

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.

How to Calculate Product Quantities from a Total Value in Excel
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.
Before you start

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.

Solution 1Recommended

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'.

1
Enable the Solver Add-in

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.

2
Set up your calculation table

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.

3
Open Solver Parameters

Navigate to the Data tab on the top ribbon and click on 'Solver' in the Analyze group.

4
Configure your target total

Set the 'Set Objective' field to your Grand Total cell. Choose 'Value of' and type your desired target total into the box.

5
Add constraints and solve

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 the Solver Tool with Integer Constraints
Multiple Solutions Possible: Even with integer constraints, there may be multiple combinations of quantities that equal your total. You can add more constraints (like Max or Min limits) to narrow down the exact scenario.
Reverse Calculate Values Easily

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. 1. Input your data: Open WPS Spreadsheet and input your fixed prices and placeholder quantities in adjacent columns.
  2. 2. Calculate the grand total: Calculate the grand total in a dedicated cell using the formula =SUMPRODUCT(Prices_Range, Quantities_Range).
  3. 3. Open Solver: Go to the Data tab on the ribbon and select 'Solver' to open the parameter configuration dialog.
  4. 4. Set parameters and solve: Define your target total value, set the changing cells to your quantities, add integer constraints, and click Solve.
Built-in Solver tool for complex multi-variable calculationsFully compatible with Microsoft Excel formulas and add-insFree and lightweight alternative to heavy data processing appsIntuitive interface for setting up mathematical constraints
microsoft office alternative - wps office

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.