How to sum up times in an excel, taking the last cell with time as dynamic

Hi,

Your data in E2:E9 seems not datetime type but string type.
So can you try the following?

new TimeSpan(dt.AsEnumerable.Select(Function(r) r("Process Duration").ToString).Where(Function(t) TimeSpan.TryParse(t,New TimeSpan)).Sum(Function(ts)  TimeSpan.Parse(ts).Duration.Ticks)).ToString

Note: please check PresrveFormat option in ReadRange

Regards,

2 Likes