简体   繁体   中英

Excel Wizards: How to create a formula for multiplying parts of a number by one cell, and another part by another

I'm trying to create a formula whereby if (x < 500 000) * 0.0018, but if x > 500 000, then the first 500 000 should be *0.0018, and the rest multiplied by 0.0015. At the moment I have 1001 "IF" columns working together and it's very messy - an appropriate formula would be much appreciated! Alternately, a VBA solution would be fantastic.

based on Axel's formula of

=IF(A1<500000,A1*0.0018,500000*0.0018+(A1-500000)*0.0015)

For a 1M you would do the following

=IF(A1<500000,A1*0.0018,IF(A1<1000000,500000*0.0018+(A1-500000)*0.0015,500000*0.0018+500000*0.0015+(A1-1000000)*.0005))

As an alternative, you could tidy this up a bit by working out the parts you know. 500000*0.0018 is really 900, and if you were doing the amount over a million you know the second 500000*.0015 is really 750 and the sum of the first million would really be 1650. So a shorter formula that does the exact same thing is:

=IF(A1<500000,A1*0.0018,IF(A1<1000000,900+(A1-500000)*0.0015,1650+(A1-1000000)*.0005))

The way an if statement works is as follows:

=IF( some criteria that evaluates to true or false, what to do if its true what to do if its false)

The comas separate the various parts of the if statement. You can also do what is called nesting which is where you put an IF statement inside an IF statement. This is what we did for you 1M case.

=IF (True1/False1, IF(True2/False2, True2 result, False2 Result) , IF (True3/False3, True3 result, False3 Result) )

Hope that helps shed some light on if statements for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM