custom function-code for percentage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to VBA. However I have created a custom function using VBA and the
code is detailed below.

Public Function PLF(UnitsGenerated, PlantCapacity)
' This user defined function provides the PLF of the Plant in two decimals
PLF = (UnitsGenerated / PlantCapacity) * 8.76
PLF = Application.Round(PLF, 2)
End Function

The result of this custom function is shown in two digits. But I want a
percent symbol along with this result. Can anyone would suggest me the code
to be added for this for which I thank you in advance.

seenu
 
Format the cell as a percentage and change your formula to...
PLF = Application.Round(PLF, 2)/100
or add a percentage sign to the formula...
PLF = Application.Round(PLF, 2) / 100 & "%"
HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top