cancel
Showing results for 
Search instead for 
Did you mean: 

Formula to change font color

former_member406941
Participant
0 Kudos

I'm trying to write a conditional formula by right-clicking the formula field InsCoGrowth2013-2014 > Font > Color X-2 formula box >

If {@InsCoGrowth2013-2014}<0 Then crRed Else crBlack

The error message I receive 'A string is required here' and the 0 is highlighted.

The formula, InsCoGrowth2013-2014, returns a percentage. 

Thanks soooo much!

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Rich,

Try:

If CurrentfieldValue = '0' then

crRed

else

crBlack

-Abhilash

former_member406941
Participant
0 Kudos

Thanks.  That formula doesn't have errors, but it's not changing the font color to red when the return is 0 or <0.  The color is still black no matter what.

abhilash_kumar
Active Contributor
0 Kudos

Does the formula also return a '%' sign after the number zero?

In which case you would need to do something like this:

If ToNumber(Trim(Replace(CurrentfieldValue,'%',''))) < 0 then

crRed

else crBlack


-Abhilash

former_member406941
Participant
0 Kudos

Message now is "the string is non-numeric":

ToNumber(Trim(Replace({@InsCoGrowth2013-2014},'%','')))

abhilash_kumar
Active Contributor
0 Kudos

What kind of string does the formula @InsCoGrowth2013-2014 output?

-Abhilash

former_member406941
Participant
0 Kudos

The formula InsCoGrowth2013-2014 is this:

if Sum({@Counter2013},{@InsuranceOrGroupName}) = 0 then "N/A" else

totext ((Sum ({@Counter2014},{@InsuranceOrGroupName}) - Sum({@Counter2013},{@InsuranceOrGroupName})) % Sum({@Counter2013},{@InsuranceOrGroupName}),1) & "%"

So it returns a percentage number + %, or "N/A".

abhilash_kumar
Active Contributor
0 Kudos

What color do you want this formula to return when the other formula returns 'N/A'?

This should work:

If currentfieldvalue = 'N/A' then

some_color_of_your_choice

else

If ToNumber(Trim(Replace(CurrentfieldValue,'%',''))) < 0 then

crRed

else crBlack


-Abhilash

Answers (0)