Output based on a code

Muthukrishnan V

Active Member
Joined
May 29, 2008
Messages
294
Office Version
  1. 365
Platform
  1. Windows
Microsoft Excel 2007. Cell C5 contains amount in numerical. Cell D5 contains a code number either 1 or 2 in numerical.
Cell E5 and F5 contain formulas to give interest based on C5 (similar formulas but with different interest rate).

My request: Cell G5 should give output: Amount in numerical. If D5 is 1, then formula based on E5. If D5 is 2, then formula based on F5. Kindly furnish me a formula to do this. Thanks.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You format would be structured like this:

=IF(D5=1,your formula based on E5,IF(D5=2,your formula based on F5,what to return if D5 is not 1 or 2))
So you would replace the red parts with the appropriate formulas, and the blue part with whatever should happen if D5 is not 1 or 2.
 
Upvote 0
=IF(D5=1,IF(C5<=300000,0,IF(C5<=500000,(C5-300000)*5%-MIN((C5-300000)*5%,10000),IF

(C5<=1000000,10000+(C5-500000)*20%,110000+(C5-1000000)*30%))),IF(D5=2,IF(C5<=250000,0,IF
(C5<=500000,(C5-250000)*5%-MIN((C5-250000)*5%,12500),IF(C5<=1000000,12500+(C5-500000)
*20%,112500+(C5-1000000)*30%))),0)

Shows error Sir. Anything wrong in ths formula. Sorry for trouble. Request help. I will copy the solution and paste. Thank you Sir.
 
Upvote 0
It looks like you have unbalanced parentheses. You have 18 "(", but only 17 ")", so you are missing a ")" somewhere.
That is always the first thing you want to check. If you do not have the same number of "(" as ")", your formula will always error.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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