Nested IF -- cannot determine why the last "value if false" not being accepted.

Excel Chimp

Board Regular
Joined
Oct 30, 2008
Messages
90
Alright, I have a real challenge. Below formula was working until I added the last string, in red. String is red is attempting to do what is described in red text below. I tried to describe this formula's operation in plain English:

If x="per lead", then return Y. If X ="per move in", then return Z. If neither of these if true, then return A. But, if resulting value is greater than T (capped amount), then return T.


=IF(IF(INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),5)="Per Lead",SUMIF(combo1,$C19&$D19&I$7,leads)*INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),3),IF(INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),5)="Per Move In",SUMIF(combo1,$C19&$D19&I$7,move_in)*INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),3),SUMIF(contractsdata[concombo1],$C19&$D19&I$7,contractsdata[Contract Amount])))>INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),4),INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),4),(INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),5)="Per Lead",SUMIF(combo1,$C19&$D19&I$7,leads)*INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),3),IF(INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),5)="Per Move In",SUMIF(combo1,$C19&$D19&I$7,move_in)*INDEX(contractsdata,MATCH($C19&$D19&I$7,contractsdata[concombo1],0),3),SUMIF(contractsdata[concombo1],$C19&$D19&I$7,contractsdata[Contract Amount])))

Help, please! I'm sure I'm doing something completely boneheaded and my formula could probably be a lot more efficent, but I'm no guru.
Thanks.:ROFLMAO:
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
To "Cap" a value, try using the MIN function.
Here is a psudo code version

=MIN(If x="per lead", then return Y. If X ="per move in", then return Z. If neither of these if true, then return A, T(cappedamount))
 

Excel Chimp

Board Regular
Joined
Oct 30, 2008
Messages
90
To "Cap" a value, try using the MIN function.
Here is a psudo code version

=MIN(If x="per lead", then return Y. If X ="per move in", then return Z. If neither of these if true, then return A, T(cappedamount))

doh! Wow, you just made made formula a whole lot simpler. Thank you.

I do remain curious about why my IF statement in red would not work. I think it has something to do with order of operations /parentheses but I couldn't figure it out.

In any case THANKS!
 

Watch MrExcel Video

Forum statistics

Threads
1,130,051
Messages
5,639,773
Members
417,112
Latest member
PachRedoc

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
Top