I want to split a string with delimiter '-' and get the result of the first three characters before the delimiter in the same sheet

Hi all, I want to split cell values which are separated by delimiter “-” to multiple rows I want the output in the same column and sheet.
like INR - Indian Rupee. I want INR only in that column and delete the data after the delimiter.Tried string manipulation but that doesn’t work, any idea how I can get a solution to it?

Thanks in advance

“INR - Indian Rupee”.Split("-"c)(0)

Yes, but what i am doing is taking the excel range in a data table using a using an if condition if Convert.ToString( customerData.Columns(“Local/Transactional Currency”)).Contains(“-”) and if this is true then it splits the cell value and stores it into variable Convert.ToString( customerData.Columns(“Local/Transactional Currency”)).Split("-"c)

1 Like

@Rishi_Mukherjee Since you want to Update the cells in an Excel, Follow these Steps if you have not tried performing them :

  1. Read the Excel File, using Read Range Activity, get Output as Datatable.

  2. Use For Each Row of the Datatable
    Inside For Each Row, Use an If Condition in this way row(“ColumnName”).ToString.Contains(“-”)
    If true, then use An Assign Activity in this way : row(“ColumnName”) = Split(row(“ColumnName”).ToString,“-”)(0)

  3. Outside the For Each Row Loop,
    Write the Datatable to an Exce Sheet

These Steps Should work


Thanks a lot it worked :smile: :smile: