lord_seagrave Posted March 22, 2016 Report Share Posted March 22, 2016 Hi can anyone help me with returning dates in an Excel IF formula? I have a date in E2 as dd/mm/yyyy and I may also have a date in N2. I want an IF formula that returns a date 5 years after N2, or, if N2 is blank, returns a date 5 years after E2. Pretty easy, huh? LS Quote Link to comment Share on other sites More sharing options...
lord_seagrave Posted March 22, 2016 Author Report Share Posted March 22, 2016 FYI, I tried =IF(ISBLANK(N2),DATE(E2+5,E2,E2),DATE(N2+5,N2,N2)) ...and Excel doesn't like it :( LS Quote Link to comment Share on other sites More sharing options...
lord_seagrave Posted March 22, 2016 Author Report Share Posted March 22, 2016 ...and I've tried =IF(ISBLANK(N2),E2+DATE(5,0,0),N2+DATE(5,0,0)) ...and Excel has given me 25/10/2019 in response to 24/11/2014 I don't understand that at all. LS Just to be clear if 24/11/2014 goes in, I want 24/11/2019 out! LS Quote Link to comment Share on other sites More sharing options...
CaptainBeaky Posted March 22, 2016 Report Share Posted March 22, 2016 Hold on, I'll have a butcher's... Quote Link to comment Share on other sites More sharing options...
CaptainBeaky Posted March 22, 2016 Report Share Posted March 22, 2016 (edited) Ok - ISBLANK doesn't work as a logical test inside the IF function, and your DATE syntax needs to be altered Try: =IF(N2="", DATE(YEAR(E2)+5,MONTH(E2),DAY(E2)), DATE(YEAR(N2)+5,MONTH(N2),DAY(N2))) No line feeds or anything - looks a bit strange on my phone screen, but copied straight from the test cells. Hope this helps Edited March 22, 2016 by CaptainBeaky Quote Link to comment Share on other sites More sharing options...
bk Posted March 22, 2016 Report Share Posted March 22, 2016 With dates in Excel I normally concert into an integer and you can manipulate much more and then convert it back if that makes sense Quote Link to comment Share on other sites More sharing options...
McSpredder Posted March 22, 2016 Report Share Posted March 22, 2016 You can tell Excel the new "five years after E2" date by using DATE ( YEAR(E2)+5, MONTH(E2), DAY(E2) ) and incorporate this into your IF(ISBLANK) formula as below: =IF ( ISBLANK(N2), DATE(YEAR(E2)+5, MONTH(E2), DAY(E2)), N2) Quote Link to comment Share on other sites More sharing options...
lord_seagrave Posted March 24, 2016 Author Report Share Posted March 24, 2016 Ok - ISBLANK doesn't work as a logical test inside the IF function, and your DATE syntax needs to be altered Try: =IF(N2="", DATE(YEAR(E2)+5,MONTH(E2),DAY(E2)), DATE(YEAR(N2)+5,MONTH(N2),DAY(N2))) No line feeds or anything - looks a bit strange on my phone screen, but copied straight from the test cells. Hope this helps Perfect, Beaky, thank-you very much indeed! LS Quote Link to comment Share on other sites More sharing options...
Grandalf Posted March 24, 2016 Report Share Posted March 24, 2016 Sorry, did somebody say something... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.