How to find unique values in excel and write the output in excel or txt file

Hello Dev’s how i can capture the if we have unique values in excel and write the output data in txt or in excel for that unique values. Attached the excel.image 631_New_Form_sg_form_m1.xlsx (19.3 KB)

Thanks

1 Like

@Bhupesh_Gupta
Lets assume you have readin the excel into a datatable e.g. dtData

dtData.AsEnumerable.Select(Function (x) x(“sg_form_form”).toString.Trim).Distinct().toList

will return as string list e.g. ECVWSVCR2, ECVWSVCR3 ,ECVWSVCR4

And if you want to find out if Distincts are present you can do within an if and a condition like dtData.Rows.Count = DistinctsListVar.Count True for no distincts

1 Like

@ppr can you please sharethe main.xaml must be helpful

much appreciated
Thanks

@Bhupesh_Gupta
will do the implementation after my jobwork and pass it to you

1 Like

Thanks @ppr please share

@Bhupesh_Gupta

Find starter help here
Bhupesh_Gupta.xaml (7.9 KB)

As it was mentioned for first column it is possible to work on String list level with first column

Xaml is showcasing:

  • get Distinct Values
  • get Duplicated Values Only
  • get Non Duplicated Values Only
  • Get Count Statistics:
    ECVWSVCR2 has count of 2
    ECVWSVCR3 has count of 1
    ECVWSVCR4 has count of 1
1 Like

@ppr Thanks it is working for me but one update as i don’t want the count that have unique values i.e. image .
i only want the count of duplicates values.
if 4,3 or 2 count it is print.
if 1 count it should not print.

@Bhupesh_Gupta
Just dig more on the examples and get through the different building blocks. This will bring you on adopt and modify it by your own.

Playing with filtering and counts give a try on:

(From d In dtData.AsEnumerable
Group d By k=d(0).toString.Trim Into grp=Group
Where grp.Count > 1
Select grp.First()(0).toString + " has count of " + grp.Count.toString).toList

1 Like

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