Forum Discussion

RodericWest's avatar
RodericWest
Qrew Trainee
8 years ago

Numeric Formula font color change

I have a Numeric Formula. It is a simple subtraction field.
[Total Points 2015-16]-[Total Points 2016-2017] 
I would like to have it turn green when positive, and red when negative. 
I understand you can not do any conditional formatting in a Numeric Formula field. 
I understand you need to use a TextFormal Field. 
I have tried different things i have seen in other post, but i simply can not get it to work at all. 
What formula can i use to make this happen?
  • Try this

    // enter your field name here:
    var number Rounded = Round([My Points Subtraction field]);

    var text MyNumberInText = ToText($Rounded); 


    var text ColorCode =
    If(
    $Rounded < 0,"pink", "green");


    Case($ColorCode,
    "pink","<div style=\"background-color: pink;\"" & ">" &  $MyNumberInText  & "</div>",

    "green","<div style=\"background-color: #00C957;\"" & ">" &  $MyNumberInText & "</div>")
  • var number points = [Total Points 2015-16]-[Total Points 2016-2017];

    If( $points >= 0 , "<span style=\"color:#008000; font-weight:bold\">"&$points&"</span>", "<span style=\"color:#ff0000; font-weight:bold\">"&$points&"</span>"  )

    I hope this will solve the issue !!!