Count unique records against 3 columns

Hi all
I have a table in Excel with 3 columns.
How can I count unique records against 3 columns?
The result must be
I tried with read range otput D1 and assign DT2=DT1.DefaultView.ToTable(True)
but duplicates them from below

Hi @pl.rusinov

Can you explain little bit more about the problem?

hi @ashvani.kumar
I have excel table. in column “A” is a product number, in column “B” information about it in column “c” whether it is available. In column “A” the product number is duplicated, and in column “C” the result is sometimes different for the same product. the aim is to remove duplicate rows relative to column “A” and count only the unique records in 3 columns. as shown in the second picture. I tried DT2=DT1. DefaultView.ToTable(True) but it saves my values like that
But the result must be
i.e. e.g. after the expression DT2=DT1. DefaultView.ToTable(True) I have a result in column a remain duplicate results, and I should have only one row as per the repost photo


Thanks for explaining. There is one more thing I would like to ask.
For Product Number 5699510 and 5700302, There are two records for each, which one of two is valid for each product number and should be there in the final output.

we would understand it in this direction

group the data on colA, colB
From the group members take the last member (as we do see NOK and not OK)

5699510 information OK
5699510 information NOK

dt2 =

(From d in dt1.AsEnumerable
Group d by k1 = d("ColA").toString.Trim,k2 = d("ColB").toString.Trim into grp=Group
Select r = grp.Last()).CopyToDaTable

Modify ColA, ColB name or index to your details

Also have a look here:

Yes. in this case, only the one that is NOK as in the second photo should remain

in addition to above we would also highlight the case of 5702340
in the output we only see 5702340 information NOK

From the groups we would have:
5702340 information OK
5702340 communikation NOK

so it also not conform to the definition from the quote.

We would recommend also to recheck the requirements.

Kindly note: DT1. DefaultView.ToTable(True, {“ColA”}).Rows.Count will return 9

Thank you

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