Remove part of a string row by row and store new value and roundup coloumns value

Hi All,

I have an excel in which colomn(Completion status) has values, i want only percentage value to keep there, and also colomn(hours) has decimal values where i want whole number like anything 0.1,0.2,0.3…0.9 = 1 , Please help me out. thanks in advance!!!.Please refer the sample filesamplefile.xlsx (56.9 KB)

Hi @manohar,

Please read the excel to a datatable and inside the for each row activity,
assign row("Completion Status") = System.Text.RegularExpressions.Regex.Match(row("Completion Status").ToString,"(?<=\().*(?=\))")
This will capture only the percentage value.

To convert the decimal values to whole number, Please assign, row("Hours") = cint(row("Hours"))
If you have any doubt, please check this workflow.Excel_Automation_%_Round.xaml (7.7 KB)

Warm Regards,

I noticed this just now. In the above post, cint(row(“Hours”)) converts a decimal to the next integer number, if it’s fractional part is greater than .5 , like 1.3 -> 1 , 1.6 -> 2.
If you would like to convert the decimals to intergers like “0.1,0.2,0.3…0.9 = 1”,
Please assign, row("Hours") = math.Ceiling(convert.ToDouble(row("Hours")))

Warm regards,

1 Like

Hi nimin,

Thanks a lot, it worked absolutely fine, great work!!!

1 Like

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