# How to truncate value after 2 decimal place

Hello friends,

I want to remove any value after 2 decimal place can any one help me.

Eg:12.38888
i need 12.38

You can try with Regular Expression

``````System.Text.RegularExpressions.Regex.Match(YourString,"\d+.\d{2}").Tostring
``````

It will get only 2 decimal place

Hi @aslam_ali1,

Use Math.Round function like Math.Round(CDbl(your_number_string),2)

Another way to achive

``````CDbl("125.25253").ToString("N", System.Globalization.CultureInfo.InvariantCulture)
``````

yourNumber = Math.Round(yourNumber, 2)

Another way @aslam_ali1

``````Double.Parse("123456.123232").ToString("#.00")
``````

Thank you @Gokul001 for your quick response.

Assign Activity:
originalNumber = 12.38888

Assign Activity:
roundedNumber = Math.Round(originalNumber, 2)

dear Aakash thanks for your quick response
it will round up the value, i wanted just 2 numbers and it should not round value

dear @lrtetala thanks for quick response.

it will round up the value, i wanted just 2 numbers after decimal and it should not round up value

1 Like

dear @Gokul001 this is again rounding the value

8.88888 is giving 8.89

i wanted just 8.88

Dear @Gokul001

8.888888 expected op 8.88

8.88 expected op 8.88

8.8 expected op 8.80

8 expected op 8.00

Try with this @aslam_ali1

Dear @Gokul001 it has only one problem, it is rounding off the number.
I wanted 12.88 if input is 12.888888

im getting below op
Double.Parse(“123456.8888”).ToString(“#.00”)
Output=“123456.89”

try this let me know if you need the workflow will share it

Can you tried with Format Cell activity @aslam_ali1

Regards

HI @aslam_ali1
Math.Round(CDBl(number),2).ToString you can also try this one

Regards,
Gayathri M K

@Gayathri_Mk getting 8.89 as output

Expected output 8.88

@aslam_ali1 try this

Thank you @Gayathri_Mk

It worked

1 Like