Sum of columns

Hi @shreyaank,

It due to null value in the column so try below code

Convert.ToString(dt.AsEnumerable().Sum(Function(row) Convert.ToDouble(IIF(String.IsNullOrEmpty(Convert.ToString(row("test"))),"0",Convert.ToString(row("Current"))))))

Regards,
Arivu

5 Likes

hi u can take coloumn count and process it in a for each loop and in write range give range as coloumn count

what exactly is ā€œTestā€ over here? should i replace it with any other thing in my code?

Yes @shreyaank, which column you want to sum that column name you need to give there.

Regards,
Arivu

Thanks man, it worked!!

hI Arivuu,

Im trying to subtract two values and getting the below error. Can you please help?

ā€œmessageā€: ā€œAssign : cannot substract a System.Double from a System.Stringā€,

HI @shreyaank,

Before that convert that value into Double.
Convert.ToDouble(YourStringVariable)

Regards,
Arivu

Hi @shreyaank,

Already I have the sent the mail the below link. It will be useful to others.

https://forum.uipath.com/t/sum-of-columns/68741?u=balupad14

Regards
Balamurugan.S

Thanks a lot Balupad14 , I referred those, its indeed very helpful for excel manipulation activites

Thank you. Sure . I will upload for all my further new activities. And I will try to provide the existing activities also .

Thank you
Balamurugan.S

1 Like