IF Greater Than/Less Than/Between Formula

questionking

New Member
Joined
Sep 26, 2017
Messages
17
I am trying to come up with a way to calculate the cost for a project. There is a sliding scale included with a lower percentage of cost for a higher value. For instance the first range is 0 to 500, so the first 500 would be multiplied by 1% to get a cost of 5, and so on. Starting, Ending, Percent and Value are hard values. Column E is jus the Difference multiplied by the percent. But the Difference column is where I'm having some trouble. My current formula in cell C2 is IF(B7>B2,B2,""). This runs me into trouble later though when that value changes as shown below, from 12,000 to 2,000. It doesn't pick up the 999.99 in cell C12 that I need to get there with the correct formula. Your

1. What do I need to change in my formula to capture this?

2. And is there a way to calculate this in one entire formula in the Cost column? Leaving just the Value, Percent and cost columns and getting rid of the rest?

1582741777255.png
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
if cell C2=IF(B7>B2,B2,""), How come C3 shows 499.99, should it now show 1000, presuming the formula there is
=IF(B7>B3,B3,"")
 
Upvote 0
It's a sliding scale similar to taxation. The first 500 is at 1%. The second 500 is at .8% the next 4,000 is at .6% and anything above 5,000 is at .45%.
 
Upvote 0
To your first question, try this:

MrExcel_problem-solving.xlsx
ABCD
1Range
2><=MargRate %MargAmt ($)
305001.000%5.000
450010000.800%4.000
5100050000.600%6.000
650009.99E+090.450% 
7
8Value2000.00
9Total cost15.00
Sheet11
Cell Formulas
RangeFormula
B3:B5B3=A4
D3:D6D3=IF($B$8>$B3,($B3-$A3)*$C3,IF(($B$8-$A3)>0,($B$8-$A3)*$C3,""))
B9B9=SUM($D$3:$D$6)
 
Upvote 0
And to your second question, the easiest approach is create a single expression that is the sum all of the formulas found in the cost column (and change the nulls to zeroes)...and then delete the cost column. For convenience, the formula is shown here:

MrExcel_problem-solving.xlsx
AB
10Total cost64.50
Sheet11
Cell Formulas
RangeFormula
B10B10=SUM(IF($B$8>$B3,($B3-$A3)*$C3,IF(($B$8-$A3)>0,($B$8-$A3)*$C3,0)),IF($B$8>$B4,($B4-$A4)*$C4,IF(($B$8-$A4)>0,($B$8-$A4)*$C4,0)),IF($B$8>$B5,($B5-$A5)*$C5,IF(($B$8-$A5)>0,($B$8-$A5)*$C5,0)),IF($B$8>$B6,($B6-$A6)*$C6,IF(($B$8-$A6)>0,($B$8-$A6)*$C6,0)))
 
Upvote 0
2. And is there a way to calculate this in one entire formula in the Cost column? Leaving just the Value, Percent and cost columns and getting rid of the rest?
Just a different method
Book1
ABC
1Value120002000
2Total cost64.515
Sheet2
Cell Formulas
RangeFormula
B2:C2B2=SUMPRODUCT(--(B1>{0;500;1000;5000}), (B1-{0;500;1000;5000}), {0.01;-0.002;-0.002;-0.0015})

or for the first question
Book1
ABC
1Range
2>MargRate %
300.010.01
45000.008-0.002
510000.006-0.002
650000.0045-0.0015
7
8Value200012000
9Total cost1564.5
Sheet3
Cell Formulas
RangeFormula
C3C3=B3
C4:C6C4=B4-B3
B9:C9B9=SUMPRODUCT(--(B8>$A$3:$A$6), (B8-$A$3:$A$6), $C$3:$C$6)
 
Last edited:
Upvote 0
Multiple Ifs I gotcha, thank you for your help, this is very much appreciated and helpful! That makes it a lot cleaner than having numerous columns, and values all over the place like I previously had, thank you again!
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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