Avatar of jlcannon
jlcannon
 asked on

Conditional cell shading of table in classic asp page

I have an ASP page that displays data pulled from an excel sheet with a named range called "tblData" in the cell of the table where I have a percentage number I want to make it to where if the number is between 1 and 5 then the cell is green. if the umber is between 6 and 8 its yellow, then if its over 8 its red. this is what I have now:

<%
If rs.Fields("2017 Rate") >= 1 OR rs.Fields("2017 Rate") <= 5 then
	Response.Write "<td bgcolor='green' style='width: 301px; height: 21px;' class='auto-style3'>"
Elseif rs.Fields("2017 Rate") >= 6 OR rs.Fields("2017 Rate") <= 8 then
	Response.Write "<td bgcolor='yellow' style'width: 301px; height: 21px;' class='auto-style3'>"
Elseif rs.Fields("2017 Rate") >= 8 then
    Response.Write "<td bgcolor='red' style'width: 301px; height: 21px;' class='auto-style3'>"
End If
%>
<strong>
<%=rs.fields("2017 Rate")%>
</strong></td>

Open in new window


and it just colors all the cells in that column green regardless of the number.
ASP

Avatar of undefined
Last Comment
jlcannon

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Big Monty

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jlcannon

ASKER
excellent, thank you this worked perfectly.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes