How to count duplicate rows in a column of the same excel sheet and write it to the new excel file

I am working on a scenario where I want to count the duplicate rows of the column A against column B. I am attaching the sample excel sheet. I want the output like this…

The sample excel file is attached. I want to solve it using very simple logic.

sample.xlsx (8.8 KB)

Any help in this regard will be highly appreciated.

Regards
Enthusiastic

@enthusiastic

prepare the report datatable with build datatable activity - 2 Cols: Column A, Column B - dtResult

Use an assign activity:
left side: dtresult
Right side:

(From d in YourDataTableVar.AsEnumerable
Group d by k=d("Column A").toString.Trim into grp=Group
let ra = new Object(){k, grp.Count}
Select dtResult.Rows.Add(ra)).CopyToDataTable

Also Have a look here:

1 Like

Hi @enthusiastic ,

If you want, you can also refer below xaml.
It’s similar to what @ppr mentioned.
GroupByCount.xaml (6.7 KB)

1 Like

Hi @enthusiastic

You can try below workflow.
CountValuesInAColumn.xaml (11.6 KB)

1 Like

Hi…
Its not working. In message box just headings are shown

You have designed workflow in a way as it is required by me. But its not working. Plz have a look into it.

Okay I will check and let you know

Hi @enthusiastic

Its working fine for me , can you share me your code where you have invoked it

image

1 Like

I was mixing the data table variables. Thank You.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.