Excel column scope

I have 2 excel sheets that contains marks of students from two different batches. I HAVE TO calculate the sum of marks of each student and write it to the next column named marks . And then I have to merge these two sheets and have to find who came in the top 5

https://www.youtube.com/watch?v=lTSlPJ-84jo

Hello @Aadhithyan_Suresh,

You will have to sum the Marks if the name is the same, you can use a group by query and do this once done you can simply merge two data tables which will be basically data from two sheets of excel.

  1. Dummy table
    image

  2. Group By Query
    (From p In var_DT_Test.AsEnumerable()
    Group p By
    c1=p("Name")
    Into Group
    Select var_DT_Final.Rows.Add({c1, Group.SUM(Function(x)
    Convert.ToInt32(x("Marks").ToString))})).CopyToDataTable

  3. Result
    image

  4. Once done for both the sheets you can simply use Merge datatable activity

  5. Then you can use LINQ and Order by marks and select only 5 records. Or you can sort your final datatable in an order and then select required data.

Thanks,
Prankur

1 Like