I want to change all negative values of a column to 0

In my excel sheet i have a column in which some values are negative.How will i convert all those -ve values into 0 without changing other entries.

Hi @Soniya215

Welcome to the community!!!

Follow the below steps

  1. use read range activity to read the data in the excel to a datatable
  2. Use a for each row activity to loop through the datatable records
  3. In the loop, use an IF activity to check whether the value is minus or not.

Int.32.Parse(row(“ColumnName”).ToString) < 0

If true, then update the value in the row

row(“Column Name”) = (Int.32.Parse(row(“ColumnName”).ToString) * -1).ToString

  1. Now, write the data back into the excel using Write range activity

Thanks for your reply but it is showing some error

Hi @Soniya215, Welcome to Uipath Community

As @Lahiru.Fernando said clearly, crispy.

I’m just adding the example below.

Happy Learning :slightly_smiling_face: !

1 Like

what if the values in table are in decimal number

1 Like

@Soniya215 You can use Convert.ToDouble(row(0).ToString) instead Int32.

1 Like

Thanks for your help.It worked sucessfully.

1 Like

Send me work flow bro