I wanted to sum up all the times in the given column in excel and the number of counts in the data table is dynamic, so as the last time column.
I tried getting count of the table and then passing it in the formula, but it’s not working right. Attaching a sample image. Need to add all the time in process duration and sum up in a cell in Total hours.
=SUM(E2:E10) isn’t working for me, it’s giving just last cell time, what’s working is =E2+E3+…+E10
Any suggestions would be appreciated.
Thanks
It is because the value at E10 (at least) is not a datetime format and that is why it is giving this last value. An easy remedy is to format all relevant cells to datetime format or take guidance from the image attached. You will hopefully get the desired result.
I am wondering on “=E2+E3+E4+E5+…+E10” is working fine, but why “=SUM(E2:E10)” is giving output as 00:00:00??
Do any have idea about this?
Since I couldn’t apply the formula for dynamic no. of rows in first one
variable time is GenericValue, we need to convert that to TimeSpan type and then use .Add() method to add the time
more details
after Format value activity
create a variable of System.TimeSpan type, lets say TempTime
assign TempTime = TimeSpan.Parse(time) this converts the GenericValue of time to TimeSpan type
create another variable lets say total_time of TimeSpan type, assing value 0 before the For Each Row. Now within the for loop assing total_time = total_time.Add(TempTime) this will add all the times in the excel
Hope this helps. If this answers you please mark as solution so it helps others with similar doubt