Solved

SharePoint calculated column error

Posted on 2013-06-17
1
446 Views
Last Modified: 2013-06-26
I have the following formula to calculate day difference between two dates:
=IF(OR(LEN(Date1)=0,LEN(Date2)=0)," ",DATEDIF(Date1,Date2,"d"))

Open in new window

It works great but with one exception. In a very rare situation Date2 can be greater than Date1 and the result will be negative. In this case SharePoint will display an ugly #NUM! error code.

Can you please modify the above to show 0 (zero) instead of the error code if the Date2 is greater than Date1? Thanks!
0
Comment
Question by:MisUszatek
1 Comment
 
LVL 5

Accepted Solution

by:
manojce earned 350 total points
ID: 39255341
Hi,

=IF(OR(LEN(Date1)=0,LEN(Date2)=0)," ",IF(Day(Date1)>Day(Date2),"0",DATEDIF(Date1,Date2,"d")))

Open in new window



Its working in my site.

Thanks,
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Last week I faced a strange issue recently, i have deployed SharePoint 2003 servers for one project and one of the requirements was to open SharePoint site from same server. when i was trying to open site from the same server i was getting authentic…
If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now