Require solution to DATEDIF function

kdr

New Member
Joined
Nov 23, 2010
Messages
17
I use the DATEDIF function to calculate the number of days between two dates, when this formula runs accross text instead of dates (because dates aren't always required) I recieve a #VALUE! result.

Because the spreadsheet is so large (close to 2000 rows currently) I want to be able to click and drag the formula down and not have to remove it where text is present; I want the rows where text is present to result in a blank cell and rows that have two dates to calculate with to show the number.

If there is a better formula to use, that would be fine also :)

Thank you,
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
try:

=IF(OR(ISTEXT(ref1),ISTEXT(ref2)),"",*Datedif function*)
 
Upvote 0
If you're using Excel 2007+, =IFERROR(your datedif expression, "")
 
Upvote 0
Hello kdr, welcome to MrExcel

Dates are simply formatted numbers in excel so you could perhaps check that the inputs are both numbers, something like

=IF(COUNT(A2,C2)=2,DATEDIF(A2,C2,"y"),"")
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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