If function for Current month

R

Ranjit kurian

I have a column called as Month, and this column contains only Month details
in mmm/yy formate, i need to use the IIF function for some reason, if the
month is current month(Jan/09) and previous month(Dec/08) the result should
be YES,
If its prior to current and previous months(oct/08, nov/08) the result
should be NO
 
B

Bernie Deitrick

Ranjit,

If your 'Months' are actually formatted dates, then use something like

=IF(AND(A2<=DATE(YEAR(NOW()),MONTH(NOW())+1,0),A2>=DATE(YEAR(NOW()),MONTH(NOW())-1,1)),"YES","NO")

HTH,
Bernie
MS Excel MVP
 
B

Bob Alhat

Hi Ranjit,

Try (watch for the line wrap):

=IF(AND(YEAR(D2)>=YEAR(TODAY())-1,OR(MONTH(TODAY())-MONTH(D2)>=0,MONTH(TODAY())-MONTH(D2)=-11)),TRUE,FALSE)

....Where D2 holds your date, then copy down. I have assumed that your dates
although displaying in mmmm/yy format, do hold real dates.

HTH
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top