Compare cells of datatable

Hi guys, I am trying to compare two rows in a data table, where there might be multiple values within a single cell, I want to know if all values in row 1 cell is there in row 2 irrespective of the order of values. In the below example I am trying to compare incentive plan access column to incentive plan access2 column, the order or values is different in both columns, how can I ensure that I get a Trues on comparing both of them (*Irrespective of the order). Currently I tried this statement "row(“Incentive Plan Access”).ToString.Contains(row(“Incentive Plan Access2”).ToString)

Looking at the cell, it looks like they are separated with lines. You can split cell values with the newline, so that you have a collection of all teh lines.

  1. Split both the cell values with Environment.Newline → 2 collection
    Refer this post to split How to split text by newline code "/n"? - #6 by akila93
  2. Create bool isNotMatching = false
  3. For each item in Collection1
    if(Not Collection2.contains(item)
    isNotMatching = true;

If(isNotMatching )
Items not matching
Items matching


Can you try to use pivot table.

Kindly try with this expression
arr_cell1 = row(“Incentive Plan Access”).ToString.Split(environment.newline.ToArray()).Tolist().OrderBy(Function(x) x).ToList().Equals(row(“Incentive Plan Access2”).ToString.Split(environment.newline.ToArray())Tolist().Orderby(Function(x) x).Tolist()

cheers @Ashish_Mehra