Display graphic to website based on excel worksheet data

jlcannon used Ask the Experts™
Hello all,
I am needing some code on how to display a certain image based on what data is filled in on a worksheet. What I want is I have basically a red dot, yellow dot and green dot small graphic that I want to use and on the website will be a table with a name in one cell and in the cell right next it I want to depending on the spreadsheet populate it with one of those images. Lets say Steve has 4 papers due and 1 turned in on his sheet will be a column for due papers and a column for turned in papers and then a pecent complete. well I want to use the number in percent complete to determin what color gife to use on the website. If less that 40 I use red between 41 and 60 yellow and 61-100 green. Does this make sense? I would love to have this done automatically as right now I manually change the colors based on going to look at the spreadsheet and then editing the webpage.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Can you post a picture of the current graphic?
I have code I used for something similar that makes a horizontal bar chart (could be vertical) that shows x/y completed with percentages.
If the percentage is below or between certain thresholds the color of the bar changes.
My example is ASP gettiong data from Access, but it sounds like you've already figured out how to talk to Excel.


Currently it is all manual. When the spreadsheet is updated I take those numbers and then I open the html page and just change the number and manually change the picture reference so I was hoping to maybe use asp vb code to automate the process. I do know how to read data from excel and I just thought maybe there was an IF statement I could use to say "If cell b6 is <41 then this graphic if b6 >40 and <60 then this graphic if b6 >60 then this graphic.
That's exactly right

pct = [data source value]

if pct < 41 then
     Response.Write("document.getElementById('[your graphic id]'.innerHTML = 'path/to/gifyouwant';")
elseif pct > 60 then
     Response.Write("document.getElementById('[your graphic id]'.innerHTML = 'path/to/gifyouwant';")
     Response.Write("document.getElementById('[your graphic id]'.innerHTML = 'path/to/gifyouwant';")
end if

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial