stop calculating

Likeexcel

Active Member
Joined
Sep 2, 2009
Messages
308
Hello:
How do I stop the formula from calculating if the date is past certain number of months?
Cell A1= 1/1/2020, Cell B1 is the current date 1/31/2022, now assume it returns zero after 12 months so in the case from 12/31/2020 on should return zero.

Below is my formula, it continues to calculate because I do not have a cap in the formula to get it to stop counting past 12 months.

=IFERROR(IF(B$1>$A1,MAX(B2-B3,0),0),0)

thank you for any suggestions!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Maybe someone can figure out what you want, but when those cells are part of the formula and you don't provide data for them, as long as B > A and those values are Null, the result will always be 0 anyway? Maybe I'm wrong but being unsure, I'll wait to see what others say.
 
Upvote 0
Hi,

I'm confused also, you only have 2 cells of dates, and 2 cells for math, where are the Months or Anything being Counted?

Do you perhaps, want the result to be 0 (zero), if B1 is More than 12 Months more than A1?

If so, try this:

Excel Formula:
=IF(B$1>EDATE($A1,12),0,IF(B$1>$A1,MAX(B2-B3,0),0))

I took out the IFERROR because I don't think it's needed in this case, might be wrong.
 
Upvote 0
Hi,

I'm confused also, you only have 2 cells of dates, and 2 cells for math, where are the Months or Anything being Counted?

Do you perhaps, want the result to be 0 (zero), if B1 is More than 12 Months more than A1?

If so, try this:

Excel Formula:
=IF(B$1>EDATE($A1,12),0,IF(B$1>$A1,MAX(B2-B3,0),0))

I took out the IFERROR because I don't think it's needed in this case, might be wrong.
jtakw: This works! Thank you so much!
 
Upvote 0
@jtakw;
Question if you please:
If the date comparision has already been made and B > A, is there a need to test for it again?
What about

IF(B$1>EDATE($A1,12),0,MAX(B2-B3,0))
 
Upvote 0
@jtakw;
Question if you please:
If the date comparision has already been made and B > A, is there a need to test for it again?
What about

IF(B$1>EDATE($A1,12),0,MAX(B2-B3,0))

Yes, it needs to be tested again, in case B1 is Less (older) than A1, I assumed that might happen since OP was testing the dates in his original formula.
 
Upvote 0
Yes, i
Yes, it needs to be tested again, in case B1 is Less (older) than A1, I assumed that might happen since OP was testing the dates in his original formula.
No, A1 is older than B1, B1 is the current date and A1 is the starting date. thank you.
t needs to be tested again, in case B1 is Less (older) than A1, I assumed that might happen since OP was testing the dates in his original formula.
 
Upvote 0

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

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