Need help to convert column value to 2 decimal

Hi,
I need help to convert the column D into two decimal. I have tried using format value but it don’t work due to it only accept the var as generic value. Once i use read range and get a Var, the var will become datatable and it won’t be able to work in format value. Please help how am i going to change to two decimal place?

@Anneng
we can convert as following
grafik

An essential approach could look like:

  • use a for each row and iterate over all rows
  • use an assign for douing the conversion row(YourColNameOrIndex) = Convert.ToDouble(row(YourColNameOrIndex)).ToString(“F2”)
1 Like

Hi @Anneng ,

Take a look on this.

Regards
Balamurugan.S

@Anneng - Please refer the xaml file.

Excel.zip (8.7 KB)

image

Happy Learning :slightly_smiling_face:

conversion row(YourColNameOrIndex) = Convert.ToDouble(row(YourColNameOrIndex)).ToString(“F2”)

Do you have a sample? I can’t follow and what does convert.ToDouble means?

Thanks, I will test it out now.

I have error Write Line: Format specifier was invalid.
I change the column 0 to my column index 8 and the F2 to another cell. It seem like cannot work on write line.
Maybe you can explain Convert.ToDouble(CurrentRow(0)).ToString(“F2”), how does it work?

By the way how do you write the result back to the excel? Write line is only on the uipath system. I try write range and write cell, does not seem to be working.