ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to transform float to percentages within an array? (https://www.excelbanter.com/excel-programming/322731-how-transform-float-percentages-within-array.html)

Markus Scheible[_2_]

How to transform float to percentages within an array?
 
Hi newsgroup,

I produced an array containing floaters between 0 and 1
calculated as a percentage, e.g. 0,8888788888.

If I try to use them as the Text of a Text Box, this Box
shows the floater but I need to show the percentage in the
format "88,88 %". Do you know how I can transform these
array entries to the format needed?

Thanks in advance and best regards,

Markus

Tom Ogilvy

How to transform float to percentages within an array?
 
Textbox1.Text = Replace(Format(varr(i,"#0.00 %"),".",",")

--
Regards,
Tom Ogilvy

"Markus Scheible" wrote in message
...
Hi newsgroup,

I produced an array containing floaters between 0 and 1
calculated as a percentage, e.g. 0,8888788888.

If I try to use them as the Text of a Text Box, this Box
shows the floater but I need to show the percentage in the
format "88,88 %". Do you know how I can transform these
array entries to the format needed?

Thanks in advance and best regards,

Markus




Ben

How to transform float to percentages within an array?
 
you can transform most text by using the format method
fl = 0.888887888888
flstr = Str(fl)
finstr = Format(flstr, "##.00 %")
MsgBox finstr
"Markus Scheible" wrote:

Hi newsgroup,

I produced an array containing floaters between 0 and 1
calculated as a percentage, e.g. 0,8888788888.

If I try to use them as the Text of a Text Box, this Box
shows the floater but I need to show the percentage in the
format "88,88 %". Do you know how I can transform these
array entries to the format needed?

Thanks in advance and best regards,

Markus


Markus Scheible[_2_]

How to transform float to percentages within an array?
 
Hi Tom, hi Ben,

thanks a lot for the tip. Now it works perfectly...

Best

Markus



-----Original Message-----
Textbox1.Text = Replace(Format(varr(i,"#0.00 %"),".",",")




All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com