# Variable Calculation

#### Libra0099

##### Active Member
Dear All,

I need a formula which can Calculate the result in cell “E27”. Furthermore this should be flexible if I change the no of unit it should give the desired results. For example in cell 10, 12, 16 & 21

Your hlep will be very much appreciated and I am in need of this very badly.

Excel Workbook
DEFGH
3VendorUpto 15 (Units)From 15 to 30 (Units)From 30 to 40 (Units)More than 40 (Units)
4*****
5A* * * * * * * * * * *225* * * * * * * * * * *250* * * * * * * * * * *260* * * * * * * * * * *290
6*****
7*****
8UnitsTotal Amount***
9*****
1014* * * * * * * * * 3,150***
11*****
1218* * * * * * * * * 4,125***
13*** * * * * * * * * 3,375**
14*** * * * * * * * * * *750**
15*****
1635* * * * * * * * * 8,425***
17*** * * * * * * * * 3,375**
18*** * * * * * * * * 3,750**
19*** * * * * * * * * 1,300**
20*****
2145* * * * * * * * * 9,725***
22*** * * * * * * * * 3,375**
23*** * * * * * * * * 3,750**
24*** * * * * * * * * 2,600**
25*** * * * * * * * * 1,450**
26*****
27100* * * * * * * * * 9,725***
28*** * * * * * * * * 3,375**
29*** * * * * * * * * 3,750**
30*** * * * * * * * * 2,600**
31*** * * * * * * *17,400**
Sheet1

### Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Any LUCK!

Sorry for expiditing as I am stuck at my work....

Code:
``````      -------A------- --B--- -C- -D- -E- -F- G --H-- --I---
1       Vendor      helper  0  15  30  40    Units Amount
2   Acme Mousetraps        225 250 260 290      35   8425``````

The formula in I2 is

=SUMPRODUCT((H2 > \$C\$1:\$F\$1) * (H2 - \$C\$1:\$F\$1) * (C2:F2 - B2:E2))

Thanks a lot!

1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back