How to total up multiple cells of a specific column based on similar values in another column

Hi @ppr,
unfortunately it was not working.
I received following error message…

By the way, this is the code I adjusted according to my real data table…

(From d In Relevant_Columns.AsEnumerable

Group d By A=d(0) Into grp=Group

Let nr= New Object(){A, grp.Sum(Function (x) Double.Parse(x.Field(Of String)(4),nfi)).ToString(nfi),grp.Last()(1),grp.Last()(2),grp.Last()(3),grp.Last()(5)}
Select dtSummedUp.Rows.Add(nr)).CopyToDataTable

It should group first column (index: 0), total up the 5th column (index: 4) and take the last record of the other four columns (index: 1,2,3,5).
Did I adjust it correctly?

@MarcJo
IT seems To me that different or variaying indput Data is processed. Do you Process as Input CSV or Excel Data for Reading the datatable?

Looking in the column Index and the positions in the Array IT Looks Like a rearragenment. Was this intended?

Hi @ppr,
The input file which is read is a csv.
The ouput dt variable is “excel_original” - see screenshot below:


And yes, since the datatable consists of many irrelevant columns only 6 of them need to be considered, and they have to be rearranged/re-ordered.

hey @ppr,
any further idea how to solve my last problem?
Thanks in advance :slight_smile:

@ppr

Hey Robot Master, I opened your xaml & get errors (refer attached screenshots). if possible, can provide the screenshots (and the scripts) for 1st, 2nd and last activity please? Thank you!

Missing activity Missing activity2

Check Out in dependency Manager If required packages are Set and maybe Update down Grade. Reference also the Excel activities

It doesn’t work.

Error : Invalid usage of aggregate function Sum() and Type: Object.