Projection of times on timeline

Hi,

I am looking for a script giving me the total time spent on tasks in a table. The problem is that i do not need sum(datediff(day, a, b)) but I need the projection on the timeline. A sample (all including the border day): Activity a takes from day 3 to day 8, activity b from 5 to 9, activity c from 11 to 12, activity d from 4 to 5. Total projection would be from 3 to 9 plus from 11 to 12 giving a total of 9 days. I have written a function which is way too complex and way too slow. Grateful for any hint.

thanks

ohv

Projection of times on timeline

Thanks for your script. You have to solve this within one script, I dont think its possible with multiple scripts.

But you can simplify your script to make things easier. I have created a sample script, maybe this will be a starting point for your solution.