Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Excel Percentages Converted to Decimals

I am reading data from an Excel worksheet. Some of the data is percent values and these values get converted to decimals automatically -- ie 90% --> 0.90. I can't seem to find anyway to keep this from happening. Also, aren't all the data on the Excel sheet strings? So why would number formatting be happening at all?

Any advice is appreciated.

Regards.

like image 849
Kevin Avatar asked Jun 21 '12 13:06

Kevin


1 Answers

Percentage is a formatting artifact in Excel. The actual number is always a decimal fraction (0.9 in your case). Percentage is only a way to display your number on the worksheet.

If you know that a column represents percentage, you should multiply it by 100.

like image 54
Sergey Kalinichenko Avatar answered Sep 28 '22 06:09

Sergey Kalinichenko