How to round of a decimal to the nearest value?

I have a number 129454.92. I want to round it off to 1,29,455.00. The other problem is that when I read the excel file the column containing these values are converted to string type. I will have to convert it to double. How do I do that?

@ovi @arivu96

Hi @jamnanin,

Math.Round(1.2) ==> 1 Math.Round(1.5) ==> 2 Math.Round(2.5) ==> 2

If you don’t want to round the value just convert into int.

Regards,
Arivu

@jamnanin, You can also use this,

string.Format(System.Globalization.CultureInfo.GetCultureInfo("en-IN"),"{0:n}",Math.Round(Convert.ToDouble(129454.92)))

Reference : How to convert String Datatype value in Comma separated value? - #4 by MAHESH1

Regards,
Dom :slight_smile:

1 Like

Thanks @arivu96 and @Dominic. @Dominic your solution worked.