Excel Data- manipulation

image

if similar OPH values then we need do SUM of Zmasak

image

Hi @sivaramana.relangi

can you try below

Code:

(From row In DT.AsEnumerable()
                        Group row By OPH = row.Field(Of String)("OPH") Into Group
                        Let firstRow = Group.First()
                        Select DT.Clone().Rows.Add({firstRow("PRFNR"), firstRow("BUDAT"), OPH, Group.Sum(Function(r) Convert.ToInt32(r("ZMASAK")))})
                       ).CopyToDataTable()

Input:

image

Output:

image

Cheers!!

@sivaramana.relangi

Please Enable Preserve format in Read range

(From row In Dt.AsEnumerable()
                      Group row By OPH = row("OPH").ToString() Into Group
                      Let sumZmasak = Group.Sum(Function(r) Convert.ToDouble(r("ZMASAK")))
                      Select Dt.Clone().Rows.Add(Group.First().ItemArray.Take(3).ToArray().Concat({sumZmasak}).ToArray())).CopyToDataTable()

Input:
image

Output

image