How can i provide decimal to a number

I have one excel and in one column I’m having Total as header.
Total
12300
23400
34200
21300
Here before zeros i have to put dot ex:123.00,234.00,342.00
How can i proceed with this can anyone please help.

1 Like

image

Hi Chippy,

You can use the below expression,

valNumber.Trim.Substring(0, valNumber.Trim.Length-2)+“.”+Right(valNumber.Trim, 2)

This will work even if the provided number for formatting is not ending with zeros (.00). Attaching the workflow for reference.

Hope it helps you :slight_smile:

FormatNumber.xaml (4.6 KB)

Hello @Chippy_Kolot ,

Use the following expression to convert the number to decimal format :

Use for loop and assign row(“Total”) with following expression to convert all the values of Total column

row(“Total”) = Double.Parse( row(“Total”).ToString.Replace(“0”,“”),System.Globalization.CultureInfo.CreateSpecificCulture(“ES-es”)).ToString(“F2”,System.Globalization.CultureInfo.CreateSpecificCulture(“ES-es”)).Replace(“,”,“.”)

image

This will always converts the number to your required decimal format (doesn’t matter if your number contains 3 digit, less or more)

Hope it helps!

Regards,
Rohith

I tried. But it is taking as 1234500.00

@Chippy_Kolot What is your Input value?

Hello @Chippy_Kolot
Try this

System.Text.RegularExpressions.Regex.Replace("12300","0+",".00")

image

If 12300000 , then output will be “123.00”
image

@Chippy_Kolot - for clarification I just executed again and verified it’s working for me as expected regardless of 0’s after the numbers.
image