Home » excel » excel – Convert decimal to percentage

excel – Convert decimal to percentage

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m receiving data like below from an external source

enter image description here

What I need is to convert all highlighted data to percentage and I can’t lost the part after the comma.
Here is what I have tried so far:

For Each actCell In shRecipiente.ListObjects("tblRecipiente").ListColumns("All-In Rate").DataBodyRange
    If Not (Right(actCell.NumberFormat, 1) = "%") Then
        actCell.Value = Format(actCell, "#.

Answer:

#%") End If Next actCell

But I’m getting for example 396,83% instead of 3,9683%

How to&Answers:

change

actCell.value = Format(actCell, "#.

Answer:

#%")

to

actCell.value = Format(actCell / 100, "#.

Answer:

#%")

However, if it is no real % value you neet to change it to

actCell.value = Format(actCell, "#.

Answer:

#""%""")

or if you cant change the values try

actCell.Offset.NumberFormat = "#.

Answer:

#""%"""

Answer:

Divide the number by 100 and format as a percentage.

=A1/100

Edit – to check which is formatted as a percentage and which isn’t use:
=IF(CELL("format",A1)="P0",A1,A1/100) – P0 indicates a percentage format.
The formula will display all the numbers without percentages, so 150% will display as 1.5, as will 150.
Then it’s just a case of formatting the entire column back to percentages.