Function Problems

Create an Excel Shipping Cost Calculator with a Lookup Table

John WilsonJohn Wilson Nov 18, 2026 873 views

Question details

Create a shipping cost calculator that retrieves a price from a reference table based on package dimensions.

Create an Excel Shipping Cost Calculator with a Lookup Table
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user wants to select package height and width categories and find the corresponding shipping cost without a long nested IF formula.
Observed behavior
The calculator should return the cost at the intersection of the selected height and width categories.
Before you start

Decide which height and width categories are valid and collect the shipping cost for each combination. The formula below requires inputs that exactly match the category labels in the table.

Solution 1Recommended

Look up shipping costs with INDEX and MATCH in Excel

Use a two-dimensional lookup table to return the cost for a selected height and width category.

This example uses exact matches. If you enter raw measurements instead of category labels, you must first map those measurements to the appropriate categories.

1
Create the reference table

Enter four height categories in E3:E6 and five width categories in F2:J2. Fill F3:J6 with the shipping costs for each height and width combination.

2
Enter the dimensions

Enter a height category in C2 and a width category in C3. Each value must match a label in the corresponding reference range.

3
Add the lookup formula

Select a cell for the shipping cost and enter =INDEX($F$3:$J$6,MATCH($C$2,$E$3:$E$6,0),MATCH($C$3,$F$2:$J$2,0)). The first MATCH finds the row, and the second finds the column.

4
Add optional drop-down lists

Select C2, choose Data > Data Validation, select List, and set Source to =$E$3:$E$6. Repeat for C3 with Source set to =$F$2:$J$2.

5
Test the calculator

Change the selections in C2 and C3 and check that the formula returns the cost at the matching table intersection.

Look up shipping costs with INDEX and MATCH in Excel
When a match is not found: If either selected value does not match its category range, MATCH returns #N/A. Check for spelling differences or extra spaces.
WPS Spreadsheets

Build the shipping cost calculator in WPS Spreadsheets

Use WPS Spreadsheets to organize dimension categories and retrieve shipping costs with the same INDEX and MATCH formula.

  1. 1. Open a spreadsheet: Open WPS Office, choose Spreadsheets, and create a blank workbook or open an existing Excel file.
  2. 2. Set up the rate table: Enter height categories in E3:E6, width categories in F2:J2, and their corresponding costs in F3:J6.
  3. 3. Enter the selections: Type a height category in C2 and a width category in C3, matching the labels in the rate table.
  4. 4. Calculate the cost: Select an output cell and enter =INDEX($F$3:$J$6,MATCH($C$2,$E$3:$E$6,0),MATCH($C$3,$F$2:$J$2,0)). Change C2 or C3 to test the result.
Look up shipping costs by height and width category.Open and save Microsoft Excel XLSX files.Use a familiar spreadsheet interface to edit the rate table.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula return #N/A?

One or both inputs may not match a category label. Check C2 against E3:E6 and C3 against F2:J2 for spelling differences or extra spaces.

Can I use actual measurements instead of category labels?

The example formula looks for exact matches. If your table uses categories such as Small and Large, first convert each measurement to the appropriate category, then use those category values in the lookup.

How do I update shipping rates?

Edit the relevant cost cells in F3:J6. The formula will return the updated value for the selected height and width categories.

How do I prevent users from entering invalid categories?

In Excel, select each input cell and use Data > Data Validation > List. Set the height source to =$E$3:$E$6 and the width source to =$F$2:$J$2.