ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If function for Current month (https://www.excelbanter.com/excel-programming/422827-if-function-current-month.html)

Ranjit kurian

If function for Current month
 
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

Bernie Deitrick

If function for Current month
 
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


"Ranjit kurian" wrote in message
...
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




Bob Alhat

If function for Current month
 
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

"Ranjit kurian" wrote in message
...
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




All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com