Adding values of one column against duplicate names of another column in a excel sheet

Check the “Sheet2” in the attached excel file in this sheet i have apple multiple times with amounts here i want total amount of apples but if i use message box it will display 24 two times as we have apple two times. But i want to display the 24 only once. Can we achieve this? Could you help me out how to do this ?

Below is the Zip folder that contains workflow(Use “Sequence”, ignore that "Main.xaml ") to give you idea of how i am doing, Excel file. (31.0 KB)

Please help me out.


Instead of keeping For Each rows, try with Groupby and Sum using LinQ query

Check below link for an example

Hope this will help you


Hi @bhanusai_sajja ,

You can use below LINQ query to achieve the same.
Before starting with the code, Please first import “System.Linq” namespace.

On the left of the assign activity, Create a data table variable to store the output and on the right, you use the below code.

From row In Input_DT
Group row By a=row("YOUR_COL_NAME") Into grp=Group
Select grp.first

Hope this works for you,