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.
LVL 3
fjkaykr11Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael FowlerSolutions ConsultantCommented:
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

0
fjkaykr11Author Commented:
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
0
Michael FowlerSolutions ConsultantCommented:
I think the problem was the extra spaces. Here is your example with the formula working

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

Open in new window

DateDif.xls
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fjkaykr11Author Commented:
That works, thanks so much for the fast solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.