IF statement with a DATEDIF calculation in it

Nev Bentley

New Member
Joined
Oct 30, 2017
Messages
4
Is it possible to add a piece of text to say that there is no end date in the DateDif calculation I have this =IF(DATEDIF(J18,K18,"m"),"No End date") and I get the #VALUE returned
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the MrExcel board!

Try
=IF(K18="","No end date",DATEDIF(J18,K18,"m"))
 
Upvote 0
I see the logic to that - But what if I do not have a date in K18? which is why I was trying to put "No end date" in cell L18
 
Upvote 0
But what if I do not have a date in K18? which is why I was trying to put "No end date" in cell L18
Then you use the formula that I suggested. :)
Here it is working as far as I understand what you are asking.


Book1
JKL
185/11/2016No end date
Datedif
Cell Formulas
RangeFormula
L18=IF(K18="","No end date",DATEDIF(J18,K18,"m"))
 
Upvote 0
so how would i do this?
=DATEDIF([@DOB],TODAY(),"Y") & "." & DATEDIF([@DOB],TODAY(),"YM") & "" this gives me Y.M which is perfect
now i need to add to this to make it one formula if possible,
if the result is <18 ,"needs approval","ok"
how would i do that?
 
Upvote 0
Your question is not clear. You seem to be asking for the formula to return a Y.M value and also "ok" too. Did you mean for the formula to return either the age warning or the Y.M value? If so, try this...

=IF(DATEDIF([@DOB],TODAY(),"Y")<18,"Needs Approval",DATEDIF([@DOB],TODAY(),"Y") & "." & DATEDIF([@DOB],TODAY(),"YM") & "")

Not sure why you are concatenating the empty text string ("") on the end of your Y.M value, but I left it in because your original formula had it.
 
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