Simple Logical Formula

austinandrei

Board Regular
Joined
Jun 7, 2014
Messages
117
Hi,
I'm having a hard time in trying to simplify my IF formula without restating the logic if the value was not achieve.
Say I'm trying to get the difference between years then add one and if the answer is 5, then it will take 4 instead of 5 so I'm using below:
Rich (BB code):
=IF(1+YEAR(E$5)-YEAR($I$5)>4,4,1+YEAR(E$5)-YEAR($I$5))
What I don't want or to eliminate in the IF formula is the redundant statement of the RED font. Is it possible that if the answer is <=4, then just use the answer on the BLUE font and not to reinstate it again as it is making my overall formula longer.
Thanks!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
=min(4, year(e5) - year(i5) + 1)
 
Upvote 0
Thanks a lot shg! Didn't thought of using MIN formula for that. :)
But for future reference as the sample above will not always be a number, would there be a simple IF?
 
Upvote 0
Hi shg,I'm okay now. I just thought that IFERROR will do for the samples I have which is not applicable to the above sample. :) Thanks!
 
Upvote 0
Hi, I just thought of one which cannot be done using IFERROR or MIN
=IF(1+YEAR(E$5)-YEAR($I$5)>4,"More than 4Yr Plan",1+YEAR(E$5)-YEAR($I$5))
 
Upvote 0
I have same issue as above now since E5 might be blank so it would pick up Year(E$5) as 1901 since Cell E5 is blank. so the answer would be -116 and Min(4,-116) would pick -116 but instead of -116, any number below 1 should pick 1 as the minimum.

Also,should not be an array formula. Thanks.
 
Last edited:
Upvote 0
Sorry for like spamming the recent list. I know what to do now. using Max(1+YEAR(E$5)-YEAR($I$5),1) inside the MIN formula to force all negative values to 1.
My pending question now is the one above:
Rich (BB code):
=IF(1+YEAR(E$5)-YEAR($I$5)>4,"More than 4Yr Plan",1+YEAR(E$5)-YEAR($I$5))
 
Last edited:
Upvote 0
Sorry for like spamming the recent list. I know what to do now. using Max(1+YEAR(E$5)-YEAR($I$5),1) inside the MIN formula to force all negative values to 1.
My pending question now is the one above:
Rich (BB code):
=IF(1+YEAR(E$5)-YEAR($I$5)>4,"More than 4Yr Plan",1+YEAR(E$5)-YEAR($I$5))
Here is one way to do it without the repeated calculation...

=IFERROR(0+TEXT(YEAR(E5)-YEAR(I5)+1,"[<5]0;"""""),"More than 4Yr Plan")

Personally, I would just go with the repeated calculation.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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