Embedded IF function using Dates

bluebell123

New Member
Joined
Jun 17, 2016
Messages
2
Hi,

I was wondering if somebody could help.

I'm trying to identify apply an embedded IF formula to identify whether a date in a one cell is before or after another cell.

The two date cells my formula is referring to are loss date and renewal date.

The IF function reads:
  • if the loss date is after the renewal date - return the renewal date
  • if the loss date = the renewal date - return the renewal date
  • if the loss date is before the renewal date - return the renewal minus 366

Loss date is in column U and the Renewal Date is in column CA. Both columns are formatted as a short date.
So the formula I have entered is:
=IF(U1>CA1, C1, IF(U1=C1, C1, IF(U1<CA1, CA1-365)))

Applying the above formula results in the last embedded formula to be triggered even if the logical test does not apply.

Any help would be greatly appreciated.

Thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Welcome to the Board!

Since like you could just do this:
Code:
=IF(U1 < CA1,CA1-366,CA1)
 
Upvote 0
Thank-you both for your reply - I realised the formulae you both suggested is alot simpler however for some reason when I go to do a manual check, the if function does not return the correct value. As you can imagine this is quite frustating as the formula makes complete sense in my head :confused:
 
Upvote 0
however for some reason when I go to do a manual check, the if function does not return the correct value.
Let us know the values you have in U1 and CA1, the result you are getting, and your expected result.

Also, make sure that the values in U1 and CA1 are entered as dates, and not as text!
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

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