Is there a way to remove words before "-" from a specific column in excel?

Need Help…

I have data in sheet1 as shown below:

1

I want robot to perform activity in excel and create output as shown below:

2

Requirement : Check the Course column and if cell contains data like: “Computer science - Data Structure” it should remove words shown before including “-” to “Data Structure”

give a try at following:

Excel Application Scope
read range - output: dtData

We had read the excel into a datatable - dtData

For each row | row in dtData

  • Assign Activity:
    row(“Course”) = row(“Course”).toString.Split("-"c).Last().Trim()

then feel free write back the datatable to Excel when it is needed

You can refer to this tutorial https://forum.uipath.com/t/how-to-manipulate-a-part-of-string-split-trim-substring-replace-remove-left-right/140180

Hi @mavsp8 ,

what about below

Input
image

output
image

Workflow

Xaml
Sequence1.xaml (3.6 KB)

(From r In dt.AsEnumerable
Let ra = r("Course").ToString.Split(CChar("-")).Last
Let xx = r("Course").ToString
Select dt.Clone.Rows.Add(String.Join(",",r.ItemArray).ToString.Replace(xx,ra).Split(CChar(",")))).CopyToDataTable()

Thanks,

This works fine but the only issue is it creates blank space before every word like
" defg"
" Imnop"

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