# Total of excel column

HI,
i have a use case like my excel have to columns as below

AcctType BAL

SA 100
SA 100
CA 200
CA 100
SA 200

Result: Total SA=400
Total CA=300

Any help on achieving these.

Hi @balu ,
Check this one.

Regards
Balamurugan.S

Hi @balu
Steps
1.use read range activity for excel and gv datatable
2.use for each row in dt
3.use calculator app
4.check the if condition as row(“column name”).Tostring.contains (“sa”) type the row value of in calculator perform the manipulation
5.store the result using copy selected text
6.use write range to store the result in excel

Thanks
Ashwin.S

@balu

Refer this also… it might help you

Regards,
Mahesh

looking for the same can you ellobrate it bro or can you provide workflow if possible.

Thanks

@balu
Please go through the link and try on your own ,
And If you stuck any where we will definitely assist you.

Regards,
Mahesh

Declaration
DataTable Variable as dta (this points to excel as DT)
Dictionary(Of string, Of string) as Dictionary how to create this??
System.Collections.Generic.Dictionary<TKey, TValue> is these the one …

@balu
First Read your Excel sheet by using ReadRange activity and strore it in a datatable variable dta

Then go to variables section on the bottom of the uipath
create a variable Dictionary
Click on the Corresponding DataType Column cell and Then click on Browse for more DataTypes
Then Type Dictionary in the search field
Select System.Collections.Generic.Dictionary
Then Select String for Key and String for Value.

Then Click on ok

Then Use one Assign Activity

``````Dictionarty=( From p in dta.Select
group p by Department=p.Item("DEPARTMENT") Into GroupA=Group
Select GroupA).ToDictionary(Function(x) x(0)("DEPARTMENT").ToString, Function(x) Convert.ToString(x.Sum(Function(y) Convert.ToDouble(y.Item("Work HR").ToString))))
``````

Regards,
Mahesh

throwing error while creating dictionary “not all generic types could be resolved”

HI @balu,
You can check it the latest updates.

Regards
Balamurugan