How to deal excel problem, if row a and row b is same ,the sum the row c number

i have a excel file as follows: if the data in row a and row b is the same , then sum the row c data ,
new
the result excel file like
11

Hi @chrisjiyiwei

Try this

(From row In DT.AsEnumerable()
 Group row By Name = row.Field(Of String)("Name"), Year = row("Year") Into Group
 Let SalarySum = Group.Sum(Function(r) (r.Field(Of Double)("Salary")))
 Select DT.Clone.Rows.Add(Name, Year, SalarySum)).CopyToDataTable()

Regards,

thanks a lot! could u give me a demo xaml?

@chrisjiyiwei

(From row In DT.AsEnumerable()
 Group row By Name = row.Field(Of String)("Name"), Year = row("Year") Into Group
 Let SalarySum = Group.Sum(Function(r) (r.Field(Of Double)("Salary")))
 Select DT.Clone.Rows.Add(Name, Year, SalarySum)).CopyToDataTable()

Output:

image

Sequence22.xaml (10.4 KB)

Cheers!!

Have a look here for the different option of grouping data

if there is a new row d - tax fee, how to calculate the row d like row c?