How to check all the values in a particular column is similar

Hi ,
I want to check all the values in a particular column is similar,if it is similar it should throw error.
In the above all values are similar to certain string(kkk), so it should throw error,
If the one value contains different then it should not throw error.

1 Like


  1. Use Read Range activity to read the data from excel file and it will give output as DataTable. Let’s say ‘InputDT’.

  2. And then try below expressions.

       Int UniqueRowCount = InputDT.DefaultView.ToTable(True,"ColumnName").Rows.Count
       Int DuplicateRowCount = InputDT.DefaultView.ToTable(False,"ColumnName").Rows.Count
     If UniqueRowCount = DuplicateRowCount
          Column does not contain duplicate rows
          Column contains duplicate rows


Another solution:

Can you try the following condition in IF activity?

dt.AsEnumerable.GroupBy(Function(r) r("TargetColumn").ToString).Count=1



Hope the below steps would help you resolve this

  1. Let’s say you have a datatable named dt with the column values
    And the same value lies in Column-2

  2. Use a assign activity like this

int_rowcount = dt.Rows.Count

Where int_rowcount is a variable of type int32

  1. Now use a REMOVE DUPLICATE Rows ACTIVITY where pass input as dt and get the output as dt
  1. Now use a IF activity like this

int_rowcount <= dt.rows.count

If true it has no duplicate records where it goes to THEN block and if false it has duplicate records where it goes to ELSE block

In then block leave it as it is

And in else block use a THROW activity and mention like this

new BusinessRuleException(“Your exception message”)

Cheers @karthik_kulkarni1

1 Like

Thank you all for giving solutions

Happy automation

Do you have any further queries on this topic


No,I dont have


Pls close this topic with right comment marked as solution