Skip to main content
Question

Formula Change from Decimal to Percentage

  • February 9, 2021
  • 0 replies
  • 280 views

Hey Everyone,

This is a Rich Text field.

I'm working on a formula that takes a field and adds some styling to try and make the field larger while being highlighted based on its value. I've been able to get the result highlighted as wanted for display purposes, but my percentage field reverts back to decimal on display, is there something I can add to change this back to percentage? 

var number margin = [Total Job Gross Margin F];
If( $margin >= 0 , "<span style=\"background-color:#fbff00; font-size:16px; font-weight:bold\">"&$margin&"</span>", "<span style=\"background-color:#ff0000; font-weight:bold\">"&$margin&"</span>" )

The result is being highlighted but in decimal: 0.2813488
But it should be: 28.13%

Any recommendations on what I can add to the code to revert this back to decimal? ([Total Job Gross Margin F] value is 28.13%)

Thanks,
Alex

------------------------------
Alex Bennett
------------------------------
This topic has been closed for replies.

  • Registered
  • February 9, 2021
A simple way would be just doing [Decimal Field] * 100. That would get you back to the percentage you are wanting and then just make sure the field only shows 2 decimal places. Not sure if that would work for all your data but I think it should. Definitely test it.