Last month AND this month

rickblunt

Well-known Member
Joined
Feb 18, 2008
Messages
609
Office Version
  1. 2019
Platform
  1. Windows
Hello, on one of my inspection records an auditor has asked for me to give them an indication if the inspections are current or not. For the sake of simplicity I have set up a sheet that captures the dates of the last inspections. (An inspection is considered current if it was done "last month"). But we have all month to do it so it is not missed unless we do not do it this month at all

I have built this formula that works fine to let me know if we missed an inspection last month. But the issue is that as soon as we do an inspection for this month (the current one) it will default back to "MISSED". In this case G12 contains my max date, and the formula resides in G13

How can I tweak the formula so that it will look at matching the max date to last month AND this month?


Excel Formula:
=IF(MONTH(TODAY())=MAX(MONTH(G12))+1,"CURRENT","MISSED")

I appreciate any help at all - thanks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi,

Try this:

Excel Formula:
=IF(MONTH(TODAY())<=MONTH(G12)+1,"CURRENT","MISSED")
 
Upvote 0
Hi,

Try this:

Excel Formula:
=IF(MONTH(TODAY())<=MONTH(G12)+1,"CURRENT","MISSED")
WOW that was fast! :) I was so close too, I was trying to put a range in there, but not getting it correct. I was put my <>'s in the wrong spot.... Thank you so much for the help and the knowledge
 
Upvote 0
@rickblunt

I took another look at this, my post above was basically "fixing" the formula you posted, but after a 2nd look, I realize that formula will Error (wrong results), if you're crossing over year.
If your Last inspection was done in December, simply adding 1 to the month (which will result in 13) will be wrong, so use this formula instead.

Excel Formula:
=IF(MONTH(TODAY())<=MONTH(EDATE(G12,1)),"CURRENT","MISSED")
 
Upvote 0
wow - gr8 catch, I had not thought of that. Thanks for going the extra effort on that - it is really appreciated. (Also gets me thinking that I need to review a few of my other formulas lol) many thanks again
 
Upvote 0
Sorry, just realized, even the modified formula is wrong, will post a fixed version in a little bit.
Busy at the moment.
Stay tuned.
 
Upvote 0
Ok, use this modified version, fully tested and works correctly:

Excel Formula:
=IF(EOMONTH(TODAY(),0)<=EOMONTH(EDATE(H12,1),0),"CURRENT","MISSED")
 
Upvote 0
Solution
Ok, use this modified version, fully tested and works correctly:

Excel Formula:
=IF(EOMONTH(TODAY(),0)<=EOMONTH(EDATE(H12,1),0),"CURRENT","MISSED")
Thanks jtakw, I think I understand the addition of the "0", though it will take me a bit to wrap my head around it - lol. Thanks again for the assistance, and for teaching me more about the nuances of excel.
 
Upvote 0
You're very welcome.

The 0 brings the Dates to the End of the same month using EOMONTH.
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,749
Members
449,094
Latest member
dsharae57

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