Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel 2010 conditional formatting

Posted on 2011-09-15
14
Medium Priority
?
258 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 93

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 93

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 93

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 93

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 800 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 1200 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 93

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 93

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

885 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