Unable to fetch exact value from excel


I have to put data as mentioned in the excel to the website.
when i am fetching percentage for ex. 40% mentioned in excel ,while entering in website it is showing 0.4 .
percentage variable is generic value .i have checked with write line also showing same as 0.4.
How can i convert 40% mentioned in excel as 40.00% ?
please help me with the same. Below are the attached screenshots.


Hi @Mathkar_kunal,

Why do you use “Generic Value”? Any particular reason?

Else it’s it a problem to write this: (Percntg * 100).ToString + “%”?

If i use as string the it gives error after completion of loop thats why keep as it is as generic value.
ok , will try as u suggested.

when excel applies formats the cell as a % format, then after read range the value is fetched in the 0.XX form (40% = 0.4*100)

to get a string in the form of 40% you can do (similar to mentioned above)
(CDbl(row(ColNameOrIndex).toString.Trim)*100).toString & “%”

Another option could be to to tick on preserve format (read range), then the result of row(ColNameOrIndex).toString.Trim should be directly 40% (as it is in the Excel cell). But preserving the format can slow down the read range and in some scenarios it is to avoid for performance tuning purpose.

1 Like

ok.thanks for reply . i will check as you suggested

I encourage you always to avoid GenericValue type. Specify exact data type you need, and you will not have any problems. In your case, you should convert your 0.1 to Double first, then multiply by 100, and then convert to String, and then concatenate “%”.
@Gabriele_Camilli is absolutely right

I have attached two files. I hope they will help you to understand the solution.

1.xlsx (8.0 KB) double.xaml (6.2 KB)


Yes, checked.worked.
Thank you.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.