Link to home
Start Free TrialLog in
Avatar of Star Gazr1
Star Gazr1Flag for United States of America

asked on

Excel DateDif

I am using DateDif in Excel and getting an error, #NUM!
See Attached file.
I know it is because the date in Cell B1 occurs before the date in Cell A1.  However I have a long list of dates I need to calculate, is there a way to fix the formula so I don't have to rearrange the Column order?    Thanks for any help.
Avatar of Michael Fowler
Michael Fowler
Flag of Australia image

Hi, your attachment is missing but in answer to your question you could use the IfError  function to allow for this

https://support.office.com/en-nz/article/IFERROR-function-c526fd07-caeb-47b8-8bb6-63f3e417f611

For example

=IFERROR (DATEDIF(A1, B1, "D"), DATEDIF(B1, A1, "D"))

Open in new window

Avatar of Star Gazr1

ASKER

Michael74,

Thanks for your reply.  Sorry I didn't upload the file correctly.  I am going to attempt the file again.
When I tried your formula, I got an error with missing parenthesis, when I added another I still am getting an error.
DateDif.xls
ASKER CERTIFIED SOLUTION
Avatar of Michael Fowler
Michael Fowler
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That works, thanks so much for the fast solution.