Wednesday, July 10, 2013

Google Spreadsheet Elapsed Business Days

Question:

( by Will Zelver )

Sample Spreadsheet:



I need to calculate the difference between start and end dates in a large spreadsheet both elapsed calendar and business days. They are in Date Time format and many of them start and end on the same day, I am using the IF-THEN function 

IF(B-A<1, "Same Day", networkdays(A,B)) to automatically differentiate these. 

However, many of them end on the next day but with the timestamp take less than 24 hours, these are also showing up as "Same Day" with the function i'm using but for business purposes they should show at least 1 business day elapsed. row 2 and 4 in the sample spreadsheet illustrate what i'm talking about. Is there a function that would account for both the same day and less than 24 hour but different days automatically?

Solution:

Now instead of formula:
=IF(B2-A2<1, "Same Day", networkdays(A2,B2))

try this:
=IF(datevalue(B2)-datevalue(A2)<1, "Same Day", networkdays(A2,B2))



As B2-A2 is giving the time difference between two dates, and datevalue(B2) is fetching only the date of B2 excluding time.

And instead of having formula in each row, you can use =Arrayformula to auto calculate for each row. Let me know if you need further help on this.


I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.

I also take up private and confidential projects:
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html 

Thanks,

No comments:

Post a Comment