Nested, and multiple IF statements

I'm trying to calculate a tiered interest percentage where a the first $500,000.99 gets a 1.2% rate, and any remainder above gets a 1% rate. I'm pretty sure I have multiple mistakes in my work so far.


Given C7 is as number field, I want the calculation to occur if C7>0. If true:


If C7≤500000.99, multiply (0.012÷12) x C7


If C7>500000.99, multiply (0.012÷12)) x 500000.99 and add to that ((0.01÷12)) x (C7-500000.99))


The first problem is I don't know how to nest the rest first IF (or otherwise construct the IF statements):


IF(C7>0)


(then …)


IF(C7≤500000.99),(0.012÷12)xC7)); IF(C7>500000.99),((0.012÷12)×500000.99)+((0.01÷12)×(C7−500000.99))

Posted on Jan 2, 2024 3:17 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 2, 2024 9:07 PM

bob7 wrote:

tiered interest percentage where a the first $500,000.99 gets a 1.2% rate, and any remainder above gets a 1% rate.


Tiered rate problems are hard! I've had good look with the following approach, which avoids the confusion of IF or IFS, etc., and reduces to a mechanical exercise of filling in your brackets (tiers).




=MAX(0,(MIN(500000.99,A2)−0))*0.012/12
+MAX(0,(MIN(10000000,A2)−500000.99))*0.01/12


If your amount is in C7 then wherever you see an A2 in the formula change that to C7.


=MAX(0,(MIN(500000.99,C7)−0))*0.012/12
+MAX(0,(MIN(10000000,C7)−500000.99))*0.01/12


A little trick: if you are having trouble with a long formula in the formula editor you can separate it into lines using option-return, as I did for the screenshot.


SG

12 replies
Question marked as Top-ranking reply

Jan 2, 2024 9:07 PM in response to bob7

bob7 wrote:

tiered interest percentage where a the first $500,000.99 gets a 1.2% rate, and any remainder above gets a 1% rate.


Tiered rate problems are hard! I've had good look with the following approach, which avoids the confusion of IF or IFS, etc., and reduces to a mechanical exercise of filling in your brackets (tiers).




=MAX(0,(MIN(500000.99,A2)−0))*0.012/12
+MAX(0,(MIN(10000000,A2)−500000.99))*0.01/12


If your amount is in C7 then wherever you see an A2 in the formula change that to C7.


=MAX(0,(MIN(500000.99,C7)−0))*0.012/12
+MAX(0,(MIN(10000000,C7)−500000.99))*0.01/12


A little trick: if you are having trouble with a long formula in the formula editor you can separate it into lines using option-return, as I did for the screenshot.


SG

Jan 2, 2024 7:53 PM in response to bob7

Hi Bob,


I use this mnemonic for IF formulas: IF it is raining, THEN stay at home, ELSE have a picnic.


You can simplify the formula (and remove several parentheses) by using another table with 50000.99 and calculations for 0.012/12 and 0.01/12 and referring to those cells.


Also, if C7 is not less than or equal to 500000.99, then it must be greater than 500000.99. No need for the second IF.


Also, the semicolon (;) should be a comma (,) 😉.


Also, I used option return in the formula editor to insert new lines (and automatic indents) to make the formula more easy for humans to read.


After all those riders, here we go.



Formula in Table 1 D7 is

IF(C7≤Constants::$B$2,
 Constants::$B$3×C7, Constants::$B$3×Constants::$B$2(Constants::$B$4×(C7−Constants::$B$2))
)


Fill down to test other values of data.

Are those the results that you expect?


Regards,

Ian.

Jan 2, 2024 6:54 PM in response to Jerrold Green1

Thanks for that. I'm still debugging. (I added some possibly unneeded parenthesis pairs to ensure math was done correctly. I didn't include a value for if-false because from experience, I think it may not be necessary, although at one point I did try adding: , "" at one point. )


My main question now is if my use of the semicolon to separate the two main if clauses is correct.


IF(C7≤500000.99, IF(C7>0,(0.012÷12)×C7)); IF(C7>500000.99,((0.012÷12)×500000.99)) + ((0.01÷12)×(C7−500000.99)  )



Jan 3, 2024 10:14 AM in response to Yellowbox

Thanks, tons of valuable help (and very well documented)! I'm going to pick up my testing tonight or tomorrow. For the mean time, I've created the constants (in the same table just for now) and made the mods. Still getting a syntax error. I'm sure I've missed something since you proved it worked for you. The constants (and the C7 cel) are all numbers. I've tested with C7 being 500000 (and a couple of other numbers to test the logic) so far.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Nested, and multiple IF statements

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.