Solved

Excel script / formula to calculate lowest shipping cost

Posted on 2014-04-21
12
952 Views
Last Modified: 2014-04-27
Hello Experts

I would like to add an Excel  function (either VBA or formulas) to check if the freight cost is cheaper if we use a higher assumed weight, rather than the actual weight. For example, in column L, the cost / kg is 1610 for weight <45 and 330 for >45. If actual weight is 43kg, it's cheaper to ship as 45kg.

Thanks!

Tom
Freight-Calculator-20140422.1.xlsx
0
Comment
Question by:tomfolinsbee
  • 8
  • 4
12 Comments
 
LVL 8

Expert Comment

by:itjockey
ID: 40014017
where you want to put formula?

Cell L12...?

where is mention the cap of weight.....>45   <45...?

where is weight?

Thanks
0
 

Author Comment

by:tomfolinsbee
ID: 40014030
Yes, formula would go in row 12.

Actual weight is in cell B10.

Row 13 is for the "shipping weight" -- could be the actual weight, or it could be higher weight.

The upper and lower bound of each weight group is in a22:B99.

Thanks for your interest.
0
 
LVL 8

Expert Comment

by:itjockey
ID: 40014055
looking
0
 
LVL 8

Expert Comment

by:itjockey
ID: 40014148
See attached ...let me know if there is confusion..

Formula changed from VLOOKUP to INDEX  - MATCH in Row 11. it is up to you,  can revert back formula from your previous file.(in my attachment)

Formula for Cell L11=INDEX(L32:L95,(MATCH($B$10,$A$32:$A$95,1)))*$B$10
Formula For Cell L12=IF(L11>(ROUNDDOWN(INDEX($A$32:$A$95,MATCH($B$10,$A$32:$A$95,1)+1),0))*(INDEX(L32:L95,MATCH($B$10,$A$32:$A$95,1)+1)),(ROUNDDOWN(INDEX($A$32:$A$95,MATCH($B$10,$A$32:$A$95,1)+1),0))*(INDEX(L32:L95,MATCH($B$10,$A$32:$A$95,1)+1)),"")
Formula For Cell L13=IF(L12="","",ROUNDDOWN(INDEX($A$32:$A$95,MATCH($B$10,$A$32:$A$95,1)+1),0))

Copy across formula in rows.
See attached file
Thanks
Freight-Calculator-20140422.1.xlsx
0
 

Author Comment

by:tomfolinsbee
ID: 40014240
Thanks Itjockey.

I think solution needs to be able to check all the higher weight categories, not just the next  heavier category.  Solution works for actual weight 40-45kg since the next price break is >45kg.  However, if actual weight is between 30-40kg, it's still cheaper to ship as 45kg.

For example, 30kg actual weight and the quotation in Col L.  
30kg x 1610 = 49,200
45kg x 330 = 14,850

Perhaps need to use a script to loop through all the higher weight groups?
0
 
LVL 8

Expert Comment

by:itjockey
ID: 40014393
got it...

Formula for Cell L12=SUMPRODUCT(MIN((INDIRECT("$A$"&MATCH($B$10,$A$1:$A$95,1)+1):$A$95)*((INDIRECT(ADDRESS((MATCH($B$10,$A$1:$A$95,1)+1),COLUMN()))):L95)))

L13 working on it.

Thanks
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 8

Accepted Solution

by:
itjockey earned 500 total points
ID: 40015408
i guess this attachment will solve your problem....
Freight-Calculator-20140422.1.xlsx
0
 

Author Comment

by:tomfolinsbee
ID: 40019177
itjockey, thanks for the update.  The formulas look really complicated so I added another section at row 133 where I calculate the $/package for all weight categories (previously it was mixture of $/package and $/kg).  Would this simply the formula for finding the $/package where

1) min weight (column A) is > than the actual weight; and
2) the $/package is cheaper than the $/package calculated with the actual weight?

Appreciate your help with this!
Freight-Calculator-20140424.3-Wo.xlsx
0
 
LVL 8

Expert Comment

by:itjockey
ID: 40024883
Sorry For Delay In Reply ...sure on Monday or if i have time then Sunday
0
 
LVL 8

Expert Comment

by:itjockey
ID: 40026561
1) min weight (column A) is > than the actual weight; and
2) the $/package is cheaper than the $/package calculated with the actual weight?

Where do u need formula to put?


Thanks
0
 
LVL 8

Expert Comment

by:itjockey
ID: 40026567
or I suggest close this question if your original post is satisfied & go for new question.

Thanks
0
 

Author Closing Comment

by:tomfolinsbee
ID: 40026608
I've made some changes to the model which will simplify the formula so will post a new question. Thank you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now