Share via

Freight calculator

Anonymous
2017-11-20T19:00:53+00:00

I have the below two tables - Import Rates and Export Rates with the weights and Zones. Now in order to have a freight calculator could you please advice me the best formula to arrive at the below output.

Example 1

Type Import
Origin/Destination Zone 1
Weight 125kgs
Pieces 2
Freight Cost ?

Example 2

Type Export
Origin/Destination Zone 3
Weight 150
Pieces 4
Freight Cost ?

From the below tables- ( Export & Import Rates) I need to work out the freight cost based on the above inputs provided. I could chose any of the below Zone and type ( Import/Export rate) based on need and therefore the formula should automatically calculate the freight based on the Zone and Rate type combination as mentioned above. Also for weight >70 kgs. the calculation has to be as follows- for the first 70kgs take the actual rate mentioned + the balance kgs * the rate that is mentioned against the >70kgs.

Please advice what combination of formula I should use to arrive at the said output and if you could provide me one.

Export Rates

Weight (Kg.) Zone 1 Zone 2 Zone 3
0.5 kg 74.06 44.18 52.25
1.0 kg 98.21 58.97 74.59
1.5 kg 115.92 69.22 90.38
2.0 kg 132.66 80.14 105.67
2.5 kg 155.20 94.08 126.67
3.0 kg 172.27 105.34 139.27
3.5 kg 189.01 115.58 152.88
4.0 kg 205.44 127.01 165.65
4.5 kg 222.18 137.09 179.09
5.0 kg 239.57 148.01 191.86
5.5 kg 248.26 154.56 199.08
6.0 kg 255.35 161.45 206.30
6.5 kg 264.36 168.34 213.53
7.0 kg 273.38 174.89 221.09
7.5 kg 281.75 181.94 227.98
8.0 kg 289.48 188.33 235.20
8.5 kg 299.14 195.05 242.26
9.0 kg 306.54 201.77 249.48
9.5 kg 314.92 208.66 256.87
10.0 kg 323.29 214.87 263.76
11.0 kg 330.69 221.42 273.17
12.0 kg 338.74 227.47 282.58
13.0 kg 345.83 234.02 291.48
14.0 kg 353.56 239.74 300.55
15.0 kg 360.96 246.29 309.96
16.0 kg 368.05 252.67 318.70
17.0 kg 376.10 259.06 327.10
18.0 kg 382.86 264.94 335.66
19.0 kg 390.59 271.32 344.23
20.0 kg 398.96 277.37 353.14
21.0 kg 405.72 307.40 422.18
22.0 kg 412.48 314.13 431.20
23.0 kg 419.89 321.59 441.39
24.0 kg 427.29 327.78 451.19
25.0 kg 434.06 334.70 461.38
26.0 kg 441.14 341.61 470.40
27.0 kg 448.55 348.17 480.40
28.0 kg 455.63 354.72 490.20
29.0 kg 463.04 361.82 499.80
30.0 kg 469.48 368.37 509.60
31.0 Kg 483.00 408.66 750.12
32.0 Kg 496.52 420.62 773.08
33.0 Kg 510.37 432.18 794.36
34.0 Kg 523.89 445.31 815.92
35.0 Kg 537.42 457.27 838.32
40.0 Kg 604.72 513.32 947.52
45.0 Kg 671.05 568.99 1055.60
50.0 Kg 736.41 625.04 1164.80
55.0 Kg 804.36 681.30 1274.28
60.0 Kg 870.04 737.35 1382.92
65.0 Kg 936.70 793.21 1491.84
70.0 Kg 1002.71 849.07 1600.76
> 70kg Add / kg 14.17 11.96 22.68

Import Rates

Weight (Kg.) Zone 1 Zone 2 Zone 3
0.5 kg 39.31 49.22 49.39
1.0 kg 51.74 67.03 71.23
1.5 kg 62.50 82.66 86.18
2.0 kg 73.42 97.78 101.14
2.5 kg 87.86 117.77 120.62
3.0 kg 98.11 130.20 133.06
3.5 kg 108.36 142.63 145.99
4.0 kg 118.10 155.57 158.26
4.5 kg 128.18 168.00 171.02
5.0 kg 138.60 180.60 183.46
5.5 kg 154.88 171.71 206.02
6.0 kg 160.34 177.87 213.49
6.5 kg 165.98 184.18 220.77
7.0 kg 171.44 190.65 228.41
7.5 kg 176.72 196.50 235.87
8.0 kg 182.36 202.97 243.15
8.5 kg 187.64 209.29 250.61
9.0 kg 193.28 215.29 258.26
9.5 kg 198.38 222.07 265.36
10.0 kg 204.02 228.23 273.00
11.0 kg 240.66 258.05 347.65
12.0 kg 246.33 267.29 359.52
13.0 kg 251.79 276.70 371.39
14.0 kg 257.04 285.26 383.26
15.0 kg 262.50 294.67 395.14
16.0 kg 267.75 303.41 407.01
17.0 kg 273.21 312.82 419.10
18.0 kg 279.09 322.06 430.98
19.0 kg 284.34 331.13 442.62
20.0 kg 289.80 340.20 454.94
21.0 kg 295.05 406.31 465.47
22.0 kg 300.30 415.52 476.22
23.0 kg 305.76 424.93 486.53
24.0 kg 311.43 434.14 497.50
25.0 kg 316.68 443.35 507.81
26.0 kg 322.35 452.56 518.56
27.0 kg 327.81 461.97 529.31
28.0 kg 333.06 471.58 540.06
29.0 kg 338.52 481.18 550.82
30.0 kg 343.98 490.39 561.79
31.0 Kg 354.06 500.58 578.59
32.0 Kg 364.14 511.56 595.39
33.0 Kg 374.01 521.95 612.42
34.0 Kg 384.30 532.73 629.44
35.0 Kg 393.75 543.31 646.46
40.0 Kg 431.55 607.01 729.57
45.0 Kg 532.17 671.50 812.45
50.0 Kg 575.72 734.80 895.10
55.0 Kg 618.32 798.90 977.98
60.0 Kg 661.40 863.18 1060.64
65.0 Kg 704.72 860.68 1143.97
70.0 Kg 726.38 920.37 1227.07
> 70kg Add / kg 10.84 11.09 17.47
Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2017-11-22T15:58:45+00:00

    Venkat wrote:

    I tried to upload the excel file, but it looks the website you gave is a paid website 

    First, you can use any file-sharing website that you want to; for example, onedrive.live.com, which uses the same login as answers.microsoft.com, this website. I never use it because many people find it difficult to set up the file access permissions correctly.

    Second, most of these websites have pay-for "premium" options. But like box.net/files, I use the free option.

    Venkat wrote:

    I am getting some erratic values after I added some more columns in both Exports and Imports column and accordingly amended the formula to take care of these columns.

    I cannot imagine the mistakes that you made without seeing your formulas.  But the following might help.

    Re-download my example Excel file (click here) [1]. Again, ignore any preview errors. Just download the file.

    [1] https://app.box.com/s/zu216je7lunf4mtjgv017syjtuf6nmiy

    Note that I replaced the explicit range references with named references. Also, I moved each "table" to their own worksheets. That might make it easier to change the ranges.

    To manage named ranges, click Formulas > Name Manager.

    I call things "ExportExcessTable", for example. They are actually ranges, not bona fide Excel table objects. I don't use the latter because of their limitations and quirks. To each their own.

    Of course, you need to fill in the costs for the additional zones.

    I hope that is sufficient for you to correct your mistakes.  If not, I cannot help you further unless and until you upload an example Excel file that is complete.

    1 person found this answer helpful.
    0 comments No comments

Answer accepted by question author

  1. Anonymous
    2017-11-25T23:40:00+00:00

    Venkat wrote:

    As mentioned earlier Iam still facing issues where I have given examples in the attached excel. [....] the values are very erratic and gives me wrong values or error value.

    Yes, that was my mistake. Sorry about that.

    The HLOOKUP formulas (all 4) are missing an optional 4th parameter, which should be zero.

    Change HLOOKUP(B3,ExportExcessTable,3) to HLOOKUP(B3,ExportExcessTable,3**,0**), for example.

    0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-11-22T03:24:22+00:00

    Download "freight.xls" (click here) [1]. Ignore any preview errors. Just download the file.

    [1] https://app.box.com/s/zu216je7lunf4mtjgv017syjtuf6nmiy

    Venkat wrote:

    Example -1

    Weight of the shipment : 70Kgs

    Type : Import

    Zone: 1

    Freight in this case should show as 726.38 ( refer to the above Import table).

    And that is exactly what I get with the formula that I posted, when the references to column B are changed appropriate.  See Example 1 in the image below.

    Venkat wrote:

    Example -2

    Weight of the shipment : 150kgs

    Type : Export

    Zone: 3

    Freight in this case will be 

    for the first 70 kgs              =1600.76

    Balance 80 kgs = 22.68*30 =  680.40 (>70kgs rate to be considered)

    Total                                    = 2281.16

    And that is exactly what I would get if the the total weight were __100__, so that the balance is 30 per your calculation on the right.  See Example 2 in the image below.

    But the last I checked, if the total is __150__, the balance is __80__ as you show on the left, not 30. So 22.68 should be multiplied by __80__, not 30.  See Example 3 in the image below.

    Venkat wrote:

    Also while the user chooses the Type (" Export"/ "Import"), the Freight value  should be calculated based the values from the appropriate table to give the correct output.

    And that is exactly how the formula behaves, as demonstrated by the examples in the image below.

    I suspect that you neglected to update the references to column B appropriately when you set up your examples.

    If my downloaded file doesn't clear things up for you, upload an Excel file that demonstrates the formulas and calculations for your examples to a file-sharing website (e.g. box.net/files) and post the public/share URL. Test the download URL, being careful to log out of the file-sharing website first.

    Demonstration....

    Formulas:

    B6:

    =IF(B2="export",

    IF(B4>$D$4, ROUND(HLOOKUP(B3,$E$2:$G$4,3)+(B4-$D$4)*HLOOKUP(B3,$E$2:$G$4,2),2),

                             INDEX($E$4:$G$55,MATCH(B4,$D$4:$D$55,-1),MATCH(B3,$E$2:$G$2,0))),

    IF(B4>$D$4, ROUND(HLOOKUP(B3,$H$2:$J$4,3)+(B4-$D$4)*HLOOKUP(B3,$H$2:$J$4,2),2),

                             INDEX($H$4:$J$55,MATCH(B4,$D$4:$D$55,-1),MATCH(B3,$H$2:$J$2,0))))

    B13:

    =IF(B9="export",

    IF(B11>$D$4, ROUND(HLOOKUP(B10,$E$2:$G$4,3)+(B11-$D$4)*HLOOKUP(B10,$E$2:$G$4,2),2),

                             INDEX($E$4:$G$55,MATCH(B11,$D$4:$D$55,-1),MATCH(B10,$E$2:$G$2,0))),

    IF(B11>$D$4, ROUND(HLOOKUP(B10,$H$2:$J$4,3)+(B11-$D$4)*HLOOKUP(B10,$H$2:$J$4,2),2),

                             INDEX($H$4:$J$55,MATCH(B11,$D$4:$D$55,-1),MATCH(B10,$H$2:$J$2,0))))

    B20:

    =IF(B16="export",

    IF(B18>$D$4, ROUND(HLOOKUP(B17,$E$2:$G$4,3)+(B18-$D$4)*HLOOKUP(B17,$E$2:$G$4,2),2),

                             INDEX($E$4:$G$55,MATCH(B18,$D$4:$D$55,-1),MATCH(B17,$E$2:$G$2,0))),

    IF(B18>$D$4, ROUND(HLOOKUP(B17,$H$2:$J$4,3)+(B18-$D$4)*HLOOKUP(B17,$H$2:$J$4,2),2),

                             INDEX($H$4:$J$55,MATCH(B18,$D$4:$D$55,-1),MATCH(B17,$H$2:$J$2,0))))

    0 comments No comments
  2. Anonymous
    2017-11-21T20:13:46+00:00

    Thank you Joe for your solution provided. However I am still not getting the required correct values.

    Would like to summarize with the below examples for me to explain it to you.

    Example -1

    Weight of the shipment : 70Kgs

    Type : Import

    Zone: 1

    Freight in this case should show as 726.38 ( refer to the above Import table).

    Example -2

    Weight of the shipment : 150kgs

    Type : Export

    Zone: 3

    Freight in this case will be 

    for the first 70 kgs              =1600.76

    Balance 80 kgs = 22.68*30 =  680.40 (>70kgs rate to be considered)

    Total                                    = 2281.16

    ( Refer to the Export table under Zone 3 for the above values)

    Also while the user chooses the Type (" Export"/ "Import"), the Freight value  should be calculated based the values from the appropriate table to give the correct output.

    Hope the above explanation helps and makes sense in what I wanted to state. If you could kindly assist and provide me with the appropriate formula.

    Regards,

    Venkat

    0 comments No comments
  3. Anonymous
    2017-11-21T01:33:39+00:00

    The following is one way to organize the data and formulate a solution.

    First, I suggest that you sort the tables in reverse order, as shown.

    The formula in B5 is:

    =IF(B1="export",

    IF(B3>$D$4, ROUND(HLOOKUP(B2,$E$2:$G$4,3)+(B3-$D$4)*HLOOKUP(B2,$E$2:$G$4,2),2),

                INDEX($E$4:$G$55,MATCH(B3,$D$4:$D$55,-1),MATCH(B2,$E$2:$G$2,0))),

    IF(B3>$D$4, ROUND(HLOOKUP(B2,$H$2:$J$4,3)+(B3-$D$4)*HLOOKUP(B2,$H$2:$J$4,2),2),

                INDEX($H$4:$J$55,MATCH(B3,$D$4:$D$55,-1),MATCH(B2,$H$2:$J$2,0))))

    Use the Formulas > Evaluate Formula operation to see how the formula works.

    Notes:

    1. I assume the weight and cost apply to the total number of items (B4). If they are per item, change the beginning of the formula to =**B4 ***IF(...).
    2. When the weight exceeds D4 (70), I assume the excess weight is prorated. If the excess weight should be rounded up to an integer, change (B3-$D$4) to ROUNDUP(B3-$D$4, 0) .
    0 comments No comments