ContributionsMost RecentMost LikesSolutionsRe: Color-coding a field based on calculated percent Hi, Ryan! Count and Number Held are both numeric. But your post got me to thinking - how had I defined the calculated field? It was defined as numeric from when I was just dividing Count by Number Held and I must have changed it back when I couldn't get the formula to work. I re-defined it as Rich Text and now it works! Thank you so much! :-) ------------------------------ Patricia Malarkey ------------------------------ Re: Color-coding a field based on calculated percent Hi, Ryan! Thanks for your reply. I tried it as you suggested - I didn't know about the variables and that makes it so easy! - but on the third line of the IF statement, I get "Expecting number but found text". I've tried it the hard way: If( Round(([Count]/[Number Held])*100,0.01) > 10, "<div style=background-color:Black>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>", Round(([Count]/[Number Held])*100,0.01) > 2, "<div style=background-color:Red>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>", Round(([Count]/[Number Held])*100,0.01) > 0, "<div style=background-color:Yellow>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>", Round(([Count]/[Number Held])*100,0.01) <= 0, "<div style=background-color:LightGreen>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>", ToText(Round(([Count]/[Number Held])*100,0.01))) And the easy way: var number value = Round(([Count]/[Number Held])*100,0.01); var text display = $value & "%"; If( $value > 10, "<div style=background-color:Black>" & $display & "</div>", $value > 2, "<div style=background-color:Red>" & $display & "</div>", $value > 0, "<div style=background-color:Yellow>" & $display & "</div>", $value <= 0, "<div style=background-color:LightGreen>" & $display & "</div>", $display ) No joy. :-( ------------------------------ Patricia Malarkey ------------------------------ Color-coding a field based on calculated percent Hi, All! I am trying to color-code a calculated field. It's a percentage field: Count divided by Number Held. I stole this formula and adapted it from another post, but can't seem to find it again to put the link in this post. If( [Count]/[Number Held] > 0.1, "<div style=background-color:Black>" & ToText([Count]/[Number Held]) & "</div>", [Count]/[Number Held] > 0.02, "<div style=background-color:Red>" & ToText([Count]/[Number Held]) & "</div>", [Count]/[Number Held] > 0, "<div style=background-color:Yellow>" & ToText([Count]/[Number Held]) & "</div>", [Count]/[Number Held] <= 0, "<div style=background-color:LightGreen>" & ToText([Count]/[Number Held]) & "</div>", ToText([Count]/[Number Held])) This gets me most of the way there. But I'd like to display ToText([Count]/[Number Held]) as a percent (desired) or, at the very least, multiply it by 100 and round to 2 decimal places. Multiplying by 100 doesn't seem to change the result and rounding gets me all kinds of error messages. Desired result attached. Thanks in advance! ------------------------------ Patricia Malarkey ------------------------------