Solved

Excel 2010 conditional formatting

Posted on 2011-09-15
14
229 Views
Last Modified: 2012-05-12
I am trying to make a spreadsheet for checking supply voltages.  The sheet changes the local supply voltgage dependant on the country selected.  You are then shown the +/- tollerence for the supply.  This then gives me a cell to put the actual value in H1, the expected value in I1 and then the low and high tolerence in J1 & K1 respectively.

I am trying to somehow conditionally format the background colour of H1 depending on its value with if H1=I1 then it would be green and then change colour gradually to red if I head towards the limits.  It would then remain red if over the limit.

Thanks in advance
0
Comment
Question by:simonwait
  • 6
  • 6
  • 2
14 Comments
 
LVL 26

Expert Comment

by:pony10us
ID: 36544130
While I don't have Excel 2010 I would think it would be similar to 2007.

In 2007 you would select the cells you want to color and then select conditional formating.  
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36545083
simonwait,

Are you looking for a gradient within the cell?

Patrick
0
 
LVL 26

Expert Comment

by:pony10us
ID: 36545181
Good question Patrick.

Here is a file containing two examples.  The first is in column I where I used the conditional formating color scale option which creates a gradient. You can set upper and lower limits for the gradient. The second is column J where I just wanted to compare column I to two set values and so I only needed 3 colors. Bottom, middle and top. Vacation-Accrual.xlsx
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36545205
Right, but I don't think those are particularly useful for a within-cell gradient.

This seems to work, and will for all versions of Excel:

1) Shrink the column width for N:AG to 2

2) Select N1:AG1, and set the fill color to green

3) Create a formula based CF rule, using formula

=IF($H1<=$I1,($I1-$H1)/($I1-$J1),($H1-$I1)/($K1-$I1))>(34-COLUMN())/20

and fill color red

Now the amount of green and red visible will depend on how far you are from the expected value.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 36545224
Correction - In Column J I was looking for specific words contained in column J that were placed there by a formula in that cell which does a comparison.

=IF(AND(I22>0,I22<($I$3-40)),"WARNING Will Robinson WARNING",IF(I22>($I$3-39),"SYSTEM OVERLOAD way too much vacation","Whew - I'm safe"))

I then used conditional formating to look for "WARNING", "OVERLOAD" and "Whew" and assign a color based on results.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 36545291
Oh - I see.  

You are programming so that if the value in one specific cell changes the gradient level will change accordingly.  

I was thinking more along the lines that as each column is completed you wanted to set it's color. (basically a one time setting per cell).

0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36545348
>>You are programming so that if the value in one specific cell changes the gradient level will change accordingly.

That's what I THINK the Asker wants, but who knows?

:)
0
 
LVL 1

Author Comment

by:simonwait
ID: 36545762
What I was meaning was that say the target voltage is 220 but you are allowed down to 190 and up to 250 then 220 would be represented as green with 230 still green with a red tinge!  By the time we get to 250 it would be red.  The same would be true going the other way.  Incidentally all the values are variable and based on the values in the structure set out at the top of the question
0
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 200 total points
ID: 36546233
Please have a look at this file:

 Q-27310235.xlsx

It follows the technique I described in http:#a36545205
0
 
LVL 26

Accepted Solution

by:
pony10us earned 300 total points
ID: 36546397
And using the conditional formating to change the color of cell H1 based on the settings you gave last you could look at this.  I placed a screen shot of the settings on the spreadsheet.

I think Patrick's is easier to read though.  The only thing I noticed with his was that if I went to 250 I still had 1 green square but that should be easy to fix. temp-gauge.xlsx
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36546449
>>The only thing I noticed with his was that if I went to 250 I still had 1 green square but that should be easy to fix.

Yup.  Instead of using

    =IF($H1<=$I1,($I1-$H1)/($I1-$J1),($H1-$I1)/($K1-$I1))>(34-COLUMN())/20

use

    =IF($H1<=$I1,($I1-$H1)/($I1-$J1),($H1-$I1)/($K1-$I1))>=(34-COLUMN())/20

It all depends on how you want to treat the boundary condition.  If the low/high points should still be considered acceptable, leave it as is.  If we should reject at the boundary, make the change above.
0
 
LVL 1

Author Closing Comment

by:simonwait
ID: 36551148
Pony10us, your solution is exactly what I needed infact I thought I had tried that previously but obviously not quite.  I did actually think of changing to Patrick's solution as it is very clear but it wont quite fit in with my project.  Hence the points split, I hope you both find this fair
0
 
LVL 26

Expert Comment

by:pony10us
ID: 36551799
Glad we could be of help.  It's too bad that Patrick's solution wouldn't work for you.  I still think it is much easier to read.  :)
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36552386
simonwait,

Glad to help :)

pony10us,

I kept trying to come up with a two-color scale, but I see now that your three-color scale was more workable.

Patrick
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now