# Discussions

View Only

## Formula Field Coloring Help

• #### 1.  Formula Field Coloring Help

Posted 06-01-2017 16:05
Hey, guys, I have an issue trying to color the font and change the font size in a formula text field (which I made to be able to use HTML for a formula numeric field).

The issue is that the number is formatted as currency, so I am trying to pull that through into the formula text field, and I managed that, but now I can't figure out where to place the color tags.

Here is the formula.
var number Value = Round([Calculated SL Tax],0.01);

var text Decimals = "." & Right(ToText(Int(\$Value * 100)),2);

var text Thousands = If(\$Value>=1000,ToText(Int(\$Value/1000)));

var text Hundreds=Right(ToText(Int(\$Value)),3);

If(\$Value=0,"\$0.00",

If(\$Value<0, "- ")

&

"\$" & List(",",\$Thousands,\$Hundreds) & \$Decimals)

This works in returning the calculated number with the proper currency formatting, but now how do I go about changing the color and size of the font?

• #### 2.  RE: Formula Field Coloring Help

Bronze
Contributor
Posted 06-01-2017 19:37
Try this:

"<div style=\"font-size: 9pt; color:black;background-color:orange; width:80px; text-align:center; \">"&"YOUR TEXT VALUE HERE"&"</div>",

• #### 3.  RE: Formula Field Coloring Help

Posted 06-01-2017 19:43
That is kind of where I was going with it, but the text happens to be that last line of the formula;
"\$" & List(",",\$Thousands,\$Hundreds) & \$Decimals)

because it is pulling a number from the [Calculated SL Tax] field (listed above as variable 'Value') But I had to use the rest of the formula to keep the currency formatting. So basically, what do I wrap the div style with? Where do I place it so it returns the coloring? I have zero idea, and if anyone has any other way of colorizing a formula number field AND maintain formatting, im all ears

• #### 4.  RE: Formula Field Coloring Help

Bronze
Contributor
Posted 06-01-2017 19:45
you could potentially create the formula in one field and then the formula text field to colorize the result in a separate field. thoughts?

• #### 5.  RE: Formula Field Coloring Help

Posted 06-01-2017 19:49
If I follow you, you're saying to create a third field that would pull from this field and wrap that in the div style to get the coloration? If so, I think that might just work.

• #### 6.  RE: Formula Field Coloring Help

Bronze
Contributor
Posted 06-01-2017 19:50
yea, thats what I am thinking. It might be the fastest way to your solution.

• #### 7.  RE: Formula Field Coloring Help

Bronze
Contributor
Posted 06-01-2017 19:51
the formula would look like this though:

"<div style=\"font-size: 9pt; color:black;background-color:orange; width:80px; text-align:center; \">"&[YOUR FORMULA FIELD HERE]&"</div>",

• #### 8.  RE: Formula Field Coloring Help

Posted 06-01-2017 19:52
Eric, you are a genius my friend, thank you! It's perfect

• #### 9.  RE: Formula Field Coloring Help

Bronze
Contributor
Posted 06-01-2017 19:53
you're welcome! any time.