How to group data in Excel?

I have an excel that looks like this:

A 4
B 5
C 6
A 1
C 1
A 6

I want to group the data and give an output like

A total
B total
C total

Kindly help…

@arivu96 can u help me this this one??

Hi,

Refer this

Hope this may helps you

Thanks

1 Like

Hi @ksrinu070184 this is not exactly what i wanted to achieve… as u can see the question just filters based on pass or fail but here i want to group based on the name so if there are 10 A’s and each has one value, i need an output like A [total sum of all other A’s]

i’m also trying alternate ways by myself but i’m a newbie so that’s y i posted to this forum…

thnx…

Please use the LINQ query to get the work done. I have tested and working fine.

Please find the C# linq query. You can convert to VB.Net code.
Replace Column1 and Column2 in the below code.

DataTable newDt = dt.AsEnumerable()
              .GroupBy(r => r.Field<String>("Column1"))
              .Select(g =>
              {
                  var row1 = dt.NewRow();
                  row1["Column1"] = g.Key;
                  row1["Column2"] = g.Sum(r => r.Field<int>("Column2"));
                  return row1;
              }).CopyToDataTable();

Regards,
Karthik Byggari

2 Likes

Hey @cybzom

You can also use the below custom activity to group the data in the datatable…

Use the consolidate Datatable activity which is bundled in this. You can also find a user guide in the component itself so that you can easily configure it.

Hi @cybzom,

Check this thread, this will definitely helps you.

Direct Link to Post with solution ist Here

How about pivoting the data in excel @cybzom ? :smiley: