Check whether a new value is duplicated in the column

GSuite Application Scope > Read Range > For Each Row in dt4dup
Assign subDom = dt4dup.Columns.Item(1).ToString
If row(1).ToString.Equals(subDom)
Then “duplicated” Else “not duplicated”

No error when run, but seems something wrong, all result “not duplicated” but it is not correct.
Can anyone help…Thanks

@MubieSam_Lin Check is there any space in the values

Hi @MubieSam_Lin

check the row(1).ToString.Trim.Equals(SubDom.ToString.Trim)

Thanks
Ashwin S

@indra thanks for the reply, there is no space in the values.
@AshwinS2 thanks for the reply, but the results are same.

wondering…

  1. What should be the “Variable type” for subDom? if set as “String”, to Assign subDom = dt4dup.Columns.Item(1).ToString will get an error "value of type string can not convert to Array of String
  2. Refer to a VBA code sample
    If WorksheetFunction.CountIf(Range(“B2:B31”), Target) > 1 Then
    How to convert this to UiPath? what is equivalent for CountIf? should I assign another variable Target = row(1).ToString ?

Thanks