If formula based on date in another column

Aswinraj

Board Regular
Joined
Dec 10, 2015
Messages
65
Hello guys,

Need your help in getting the Excel Formula based on condition,

1. If Column A = Current Month and Column B > Current Month then Result in Column C is >MO
2. If Column A = Current Month and Column B = Current Month then Result in Column C is MO
3. Rest should be mentioned as Nill

Column AColumn BColumn C
9/31/202012/31/2020
9/31/20209/31/2020
12/31/202112/31/2021
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
try

Excel Formula:
=IF(AND(MONTH(A1)=MONTH(NOW()),MONTH(B1)>MONTH(NOW())),"> MO",IF(AND(MONTH(A1)=MONTH(NOW()),MONTH(B1)=MONTH(NOW())),"MO",""))
 
Upvote 0
Do you only care about the month, or the month and the year?
It might be helpful if you tell us your expected output from the example you posted.
(BTW, 9/31 is not a valid date, September only has 30 days!) ;)
 
Upvote 0
try

Excel Formula:
=IF(AND(MONTH(A1)=MONTH(NOW()),MONTH(B1)>MONTH(NOW())),"> MO",IF(AND(MONTH(A1)=MONTH(NOW()),MONTH(B1)=MONTH(NOW())),"MO",""))

Thanks for your Reply. It works, Sorry i missed one thing, It has to check Current Month and YEAR too. Can you please help. I tried but getting error.
 
Upvote 0
Do you only care about the month, or the month and the year?
It might be helpful if you tell us your expected output from the example you posted.
(BTW, 9/31 is not a valid date, September only has 30 days!) ;)

My mistake, Yes I need Month and Year too. :)
 
Upvote 0
See if this helps

Excel Formula:
=IF(AND(YEAR(A1)=YEAR(NOW()),MONTH(A1)=MONTH(NOW()),MONTH(B1)>MONTH(NOW())),"> MO",IF(AND(YEAR(A1)=YEAR(NOW()),MONTH(A1)=MONTH(NOW()),MONTH(B1)=MONTH(NOW())),"MO",""))


If this is not what you want then you will have to provide all the criteria exactly as you did in your initial post
 
Upvote 0
See if this helps

Excel Formula:
=IF(AND(YEAR(A1)=YEAR(NOW()),MONTH(A1)=MONTH(NOW()),MONTH(B1)>MONTH(NOW())),"> MO",IF(AND(YEAR(A1)=YEAR(NOW()),MONTH(A1)=MONTH(NOW()),MONTH(B1)=MONTH(NOW())),"MO",""))


If this is not what you want then you will have to provide all the criteria exactly as you did in your initial post

Seems like the formula which you provided compares Month and Year in Column A. But the requirement is Formula has to check both Month and Year in Column A with Column B and provide result.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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