Sumproduct problem

bezmon1985

New Member
Joined
Mar 7, 2018
Messages
3
hiya

having a little trouble with a Sumproduct formula. Below is what i would like to achieve

Cost of journey determine by length

0-29 Miles @ £1.7
30-50 Miles @ £1.6
51-80 Miles @ £1.4
80+ Miles @ £1.3

i have entered the formula (c21 being where i enter the mileage)

=SUMPRODUCT(--(C21>{0,29,30,50,51,80,81,9999}),--(C21-{0,29,30,50,51,80,81,9999}),{1.7,-0.1,-0.3,-0.4})

but it only seems to bring the correct amount upto 30 miles thereafter the result is incorrect!

Any help would be reatly appreciated

Many thanks for taking the time to look over my woes

Bezmon1985
 
What is your calculation for 100 miles?
What would be the calculation for 29.5 miles?
This example assumes brackets slightly different; please adjust to the complete definition of the brackets.


Excel 2010
ABCDEFG
1100.00150.90BracketsRaterDiff
2150.9001.71.7
3291.6-0.1
4150.90501.4-0.2
5801.3-0.1
6
4a
Cell Formulas
RangeFormula
B1= SUMPRODUCT(--(A1>E2:E5),A1-E2:E5,G2:G5)
B2= SUMPRODUCT(--(A1>{0;29;50;80}),A1-{0;29;50;80},{1.7;-0.1;-0.2;-0.1})
B4=SUMPRODUCT(--(A1>{0;29;50;80}),A1-{0;29;50;80},{1.7;1.6;1.4;1.3}-{0;1.7;1.6;1.4})
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,216,526
Messages
6,131,187
Members
449,631
Latest member
mehboobahmad

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top