IF Function with Variable Dates

olimajor123

Board Regular
Joined
Nov 13, 2013
Messages
72
Hi,

I am trying to use the IF formula with some variable dates and have tried a few combinations but have been unable to get it to work correctly for all the cells yet.

Basically I have two columns titled 'Due Date' and 'Cleared Date' and a third blank column. In the third column I want to compare whether the job was cleared before, after or on the due date. I have about 1000 rows so needless to say I don't want to do this manually!

Any help is appreciated.

Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
=choose(sign(dateCleared - dateDue) + 2, "Early", "On Time", "Late")

Copy down.
 
Upvote 0
Assuming your Due Date is column A and Cleared Date is column B, here's your formula:

<a2, "before",if(b2=""><a2, "before",if(b2=""><a2, "before",if(b2="">=IF(B2<a2, "before",if(b2="">A2,"After","On"))

Copy this formula down as far as you need and the ranges will automatically adjust accordingly.

Edit: Okay for some reason my formula won't copy paste correctly. When I click "save" or "submit", half the formula goes missing on the post.</a2,></a2,></a2,></a2,>
 
Last edited:
Upvote 0
Add a space after < so it isn't interpreted as the start of a tag.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,179
Members
448,871
Latest member
hengshankouniuniu

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