How to remove redundant words from each cell in a column from excel file

Like I’m Having ‘life Peace and Peace Calm’ but the output should be ‘life Peace Calm’ the repeated “peace” should be removed from that cell. Attaching the excel file here.
adDuplicate.xlsx (9.6 KB)

There are solutions available in the forum, please refer to this post

The marked solution there is working fine with your data. “and” has to be removed other way, i.e. by using .Replace(“and”, “”)

Hi Nico
Thanks for that link.
It is working fine but how to implement that with excel file i.e., I want to write to the particular cell if it having such condition.
Example : Input Column

If the data is how you’re showing then we can do this by looping the datatable and you can use the Split method to split “and” and take only the first index from the split string array!

1 Like

Hi @Abhi15 :slight_smile:

  1. Read the excel sheet using a Read Range activity the output will be store to a datatable
  2. Loop the datatable using For Each Row activity
  3. use an assign activity and set the following:

String.Join( Space(1), Split( CurrentRow( “Input” ).ToString, Space(1) ).Distinct ).Replace( “and”, “” )

1 Like

Thanks kunal :+1:

Please mark my answer as a solution if it worked for you. :smile:

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