Home>Blogs>Excel Tips and Tricks>Excel Solver Tutorial: Cheapest Shipping Plan (Free File)
Excel Tips and Tricks

Excel Solver Tutorial: Cheapest Shipping Plan (Free File)

Every week a warehouse manager has the same question: which warehouse should ship to which store so the freight bill is as low as possible? Doing it by habit costs real money. In this tutorial you use Excel Solver to find the cheapest shipping plan. The example is Cedar Creek Home Goods, a home goods company in Nashville, Tennessee, that ships 5,100 cases a week from Dallas, Atlanta and Columbus to five stores. The dispatcher’s plan costs $18,497 against a budget of $17,500. Solver finds a plan for $15,732, which saves $2,765 every week.

Excel Solver shipping plan with total freight cost of $15,732 and an under budget status
The finished plan: $15,732 a week, under budget by $1,768.

⬇️  Download the Free Practice Files
Practice file + solution workbook · .zip · Excel 2016 or later (Solver add-in)

Watch the Video Tutorial

Video Overview

The video opens with the finished result: last week’s plan costs $18,497, the Solver plan costs $15,732, and the holiday surge sheet covers all five stores for $18,608. Then you build it step by step from the practice file. You switch on the Solver add-in, total the plan with SUMPRODUCT, set the objective, the changing cells and the rules, and run Simplex LP. In the second use case a carrier limit of one truck (1,000 cases) per lane is added, and you see what that single rule costs.

What You Will Build

  • A cost per case table for every lane from a warehouse to a store.
  • A shipping plan with yellow cells that Solver is allowed to change.
  • A total freight cost with one SUMPRODUCT formula.
  • Cost cards and a status box that turn red or green against the budget.
  • A Solver model with an objective, changing cells and three rules.

The Practice File

The Practice file has a README tab, a Shipping Plan tab (use case 1), a Holiday Surge tab (use case 2) and a Lanes tab. On the Shipping Plan tab the cost per case table, the capacity of each warehouse (Dallas 1,800, Atlanta 2,200, Columbus 1,600) and the demand of each store are ready. The yellow cells hold last week’s plan. The Shipped and Received totals, the Total Freight Cost, the cards and the status box are empty, and you build them in the video.

Cost per case table from three warehouses to five stores in Excel
Dallas to Houston costs $2.21 per case, Atlanta to Denver $7.08.

Each cost on the Lanes tab is a handling fee of $1.20 plus the miles times the carrier rate. The yellow plan is what Solver will change.

Yellow shipping plan cells holding last week plan in the Excel Solver practice file
The yellow cells hold last week’s plan. Solver changes only these 15 cells.

Step 0: Turn On the Solver Add-in

Solver is free and already inside Excel, but it is switched off by default. Go to File, Options, Add-ins. At the bottom choose Excel Add-ins and click Go. Tick Solver Add-in and click OK. You only need to do this once.

Excel Options Add-ins dialog with Excel Add-ins selected to turn on Solver
File, Options, Add-ins, Excel Add-ins, Go.

Now the Data tab has a new Solver button on the far right.

Solver button on the Data tab of the Excel ribbon
The Solver button appears on the far right of the Data tab.

Step 1: Shipped and Received Totals

Solver needs three things: one cell to make as small as possible (the total cost), the cells it may change (the yellow plan) and the rules it must follow. First build the cells the rules need. In the Shipped column type =SUM(C16:G16) for Dallas and drag it down to Columbus. The plan ships 1,800, 1,800 and 1,500 cases, so no warehouse is over its capacity.

SUM formula for cases shipped from the Dallas warehouse
Shipped = SUM of the five yellow cells in each warehouse row.

In the Received row, for Houston, type =SUM(C16:C18) and drag it to Denver. Every store receives exactly its demand (1,100, 1,000, 1,300, 900 and 800), so this plan works. The only question is the cost.

Received row formula summing the cases each store receives
Received = SUM of the three yellow cells above each store.

Step 2: Total Freight Cost With SUMPRODUCT

In the Total Freight Cost cell type =SUMPRODUCT(C10:G12,C16:G18). SUMPRODUCT multiplies every cost by the cases on the same lane and adds all 15 results, so one cell holds the full freight bill: $18,497.00.

SUMPRODUCT formula multiplying the cost table by the shipping plan
SUMPRODUCT of the cost table and the yellow plan.

One thing to watch: both ranges must have the same shape, here 3 rows and 5 columns. If one range is bigger than the other, SUMPRODUCT returns a #VALUE! error.

Total freight cost of $18,497 for last week plan
Last week’s plan costs $18,497.00.

Step 3: Cost Cards and the Budget Status Box

Link the cards: This Plan’s Cost is =D22 and Savings vs Last Week is the freight bill minus the total cost. Right now the savings are $0 because this is still last week’s plan. For the status box type:

=IF(D22<=M9,"UNDER BUDGET by "&TEXT(M9-D22,"$#,##0"),"OVER BUDGET by "&TEXT(D22-M9,"$#,##0"))

The box turns red: over budget by $997.

Status box showing over budget by $997 before running Solver
Before Solver: over budget by $997.

Step 4: Set Up and Run Solver

Go to Data, Solver. In Set Objective select the Total Freight Cost cell and choose Min. In By Changing Variable Cells select all 15 yellow cells ($C$16:$G$18).

Solver Parameters dialog with objective, Min and changing variable cells
Objective: minimize the total freight cost by changing the yellow cells.

Now the rules. Click Add. For the first rule, Cell Reference is the three Shipped cells, the sign is less than or equal to, and the Constraint is the three Capacity cells ($H$16:$H$18 <= $I$16:$I$18): never ship more than a warehouse holds. Click Add again. For the second rule select the five Received cells, change the sign to greater than or equal to and select the five Demand cells ($C$19:$G$19 >= $C$20:$G$20): every store gets at least its demand.

Solver Add Constraint dialog for the warehouse capacity rule
The Add Constraint dialog: Shipped less than or equal to Capacity.

Make sure Make Unconstrained Variables Non-Negative is ticked. Without it Solver may ship minus cases on some lanes just to save money on paper. For the Solving Method choose Simplex LP. The model only multiplies and adds, so it is linear, and Simplex LP always finds the true lowest cost.

Solver Parameters with two constraints, Non-Negative ticked and Simplex LP selected
Non-Negative ticked and Simplex LP selected.

Click Solve. Solver reports that it found a solution and all constraints are satisfied. Keep the Solver Solution and click OK.

Solver Results dialog saying Solver found a solution
Keep Solver Solution and click OK.

The Result: The Cheapest Plan

Dallas sends 1,100 cases to Houston and 700 to Denver. Atlanta covers Miami and Charlotte. Columbus sends 1,300 cases to Chicago and 100 to Denver. The total cost drops to $15,732, savings are $2,765 a week (14.9%) and the status box turns green: under budget by $1,768. Solver also saves these settings in the workbook, so next week you update the demand, open Solver and click Solve again.

Optimal shipping plan costing $15,732 with $2,765 saved and a green under budget box
Solver’s plan: $15,732, savings $2,765, under budget by $1,768.

Why is it cheaper? Every store still gets the same cases. Solver just moved them to the cheapest lanes. In the chart, Dallas now runs full while Atlanta and Columbus still have spare cases.

Chart of cases shipped versus capacity for Dallas, Atlanta and Columbus
Dallas runs full, Atlanta and Columbus keep spare cases.

Use Case 2: Holiday Surge With a Truck Limit

Open the Holiday Surge tab. The formulas are already in place. Houston now needs 1,250 cases, Miami 1,150, Chicago 1,500, Charlotte 1,000 and Denver drops to 650. The yellow cells still hold last week’s best plan, so four stores are short and the status box says 600 cases are missing.

Holiday Surge sheet with four stores short and 600 cases missing
Holiday Surge with last week’s plan: 4 stores short, 600 cases missing.

Before running Solver check the capacity: total capacity is 5,600 cases and total demand is 5,550, so there are 50 cases to spare and a solution is possible.

Capacity check showing 5,600 cases of capacity against 5,550 cases of demand
Capacity 5,600 against demand 5,550: a plan is possible.

There is one new rule: the carrier allows at most 1,000 cases per lane a week (one truck). Open Solver, set the objective to the holiday Total Freight Cost, choose Min and select the yellow cells. Add the same two rules as before, then click Add and select all 15 yellow cells, keep less than or equal to, and click the lane limit cell as the Constraint.

Solver Add Constraint dialog for the lane limit of one thousand cases
The third rule: every lane at most 1,000 cases.

Non-Negative is ticked and Simplex LP is selected. Click Solve and keep the solution. All five stores show MET, the box says all five stores supplied, and no lane carries more than 1,000 cases. The holiday plan costs $18,608, under the holiday budget of $19,000.

Holiday plan with all five stores supplied at a cost of $18,608
All 5 stores supplied for $18,608, no lane above 1,000 cases.

Here is something useful: without the truck limit the same demand would cost $16,739. So that one carrier rule costs almost $1,900 a week. Now you can show your manager the real price of that contract.

When Solver Says “No Feasible Solution”

Let’s say Denver suddenly needs 2,000 cases. The capacity check says demand is 1,300 cases more than you can ship, and Solver answers “Solver could not find a feasible solution”. This is not a bug: there is simply no plan that follows all the rules. Compare total capacity with total demand first. Then choose Restore Original Values and type 650 back for Denver.

Solver Results dialog saying Solver could not find a feasible solution
No plan can follow all the rules, so Solver finds no feasible solution.

Want a Ready-Made Version?

This free file teaches the method. If you want a ready-to-use tool with a one-click Run Optimizer button, up to eight warehouses and 20 destinations, see the Transport Cost Optimizer in Excel (Solver + VBA). To learn SUMPRODUCT and 100+ other formulas in depth, join the Excel + AI Mastery: 100 Essential Formulas course on Next Gen Templates Academy.

Related Tutorials

Frequently Asked Questions

How do I use Solver in Excel?

Turn on the Solver add-in (File, Options, Add-ins, Excel Add-ins, Go, tick Solver Add-in). Then open Data, Solver, choose one objective cell to minimize or maximize, select the cells it may change and add your rules. Choose a solving method and click Solve.

How do I enable Solver in Excel?

Go to File, Options, Add-ins. At the bottom choose Excel Add-ins and click Go, tick Solver Add-in and click OK. The Solver button then appears on the far right of the Data tab. You only need to do this once.

What is the best solving method for a shipping problem?

Simplex LP. A shipping cost model only multiplies and adds, so it is linear, and Simplex LP always finds the true lowest cost. GRG Nonlinear may stop at a local answer in other models.

Why tick Make Unconstrained Variables Non-Negative?

Without it Solver may ship minus cases on some lanes just to save money on paper. Ticking it keeps every quantity at zero or above.

What does SUMPRODUCT do in a shipping plan?

SUMPRODUCT multiplies every cost per case by the cases on the same lane and adds all the results, so one cell holds the full freight bill. Both ranges must have the same shape or it returns a #VALUE! error.

What does "Solver could not find a feasible solution" mean?

There is no plan that follows all your rules at the same time, for example when total demand is higher than total capacity. Check the capacity against the demand first, then restore the original values.

Can Solver handle business limits like a truck limit per lane?

Yes. Add one more constraint, for example every lane less than or equal to 1,000 cases. Solver then finds the cheapest plan that respects it. In the example that rule costs almost $1,900 a week.

Is the practice file free?

Yes. The zip has the Practice and Solution workbooks for a fictional company, Cedar Creek Home Goods in Nashville, Tennessee. All names and numbers are example data.

Download the Free Practice Files

⬇️  Download the Free Practice Files
Practice file + solution workbook · .zip · Excel 2016 or later (Solver add-in)

By PK, An Excel Expert. Cedar Creek Home Goods and all names and numbers are fictional example data for learning.

Conclusion

You built a complete shipping model: totals with SUM, the freight bill with SUMPRODUCT, a status box and a Solver setup with an objective, changing cells and rules. Solver cut the weekly bill from $18,497 to $15,732 and handled a holiday surge with a truck limit. Download the free files, build along with the video and compare with the Solution file if you get stuck.

PK
Meet PK, the founder of PK-AnExcelExpert.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your Excel skills to the next level!
https://www.pk-anexcelexpert.com