Excel Related query

Hi All,

I have a decimal value in this format like 123456789.654.
I want to paste this value in my excel cell in this format (123,456,789.654).

I am able to paste the value in the excel by using String.format(“({0:N})”,(intexcel)) but it provide me value as 123,456,789.654 without parenthesis but in need parenthesis at the start and end of the no.

Hi @Luffy ,

The Parenthesis sometimes indicates that the value is negative, it is also done by the Excel Cell formatting.
So Perhaps, Do you want to convert your value to negative and then Write to the Cell ?

Converting to Negative :

String.format("{0:N}",(CDbl(intexcel)*-1).ToString)

For Just having Paranthesis :

"("+String.format("{0:N}",intexcel)+")"

@supermanPunch Not getting the correct output by using this formula “(”+String.format(“{0:N}”,intexcel)+“)”

If value is 123456789.654 I want output as (123,456,789.654)
if value is -123456789.654 I want output as (-123,456,789.654)

@Luffy ,

In that case, could you maybe try with the below :

String.format("'({0:N})",(intexcel))

@supermanPunch it shows value as '(123,456,789.654)
Still not getting the correct output

Instead of doing this in UiPath, how about if you try having an Excel template and formatting the cells where these values go to, to the format that you desire and that way when you enter your value as is, Excel will convert it to the right format.

Cheers!

Hi @Luffy
Try this:
Sequence
├── Assign - decimalValue = 123456789.654
├── Assign - formattedValue = “(” & String.Format(“{0:N}”, decimalValue) & “)”
└── Write Cell - Input: formattedValue, Worksheet Name: YourSheet, Range: YourCell

Hope it helps!!

@Parvathy Not working