If/Then to color in a cells based on classes

Posted on 2011-02-24
Medium Priority
Last Modified: 2012-05-11
I am wanting to write an "If,Then" statement for the table below. I will be making several more of these similar tables but plan to use the same class ranges and plan to simply copy and paste the If,Then statement to each new table.

The table is a correlation matrix of variables that were calculated and are either correlated against themselves or are to be correlated against other variables. The resulting correlation (represented as R is therefore sometimes negative. To account for this, an absolute value of each cell in the correlation matrix will need to be calculated (i.e. "=IF(ABS(B4)....

The ranges of the class I need to find and then color respectively are 0-0.5, 0.5-0.75, 0.75-0.9, and 0.9 - 0.9999

The colors I would like are 4 different shades of grey but can change this later.

Thanks for your help!
Question by:dougf1r
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 50

Accepted Solution

Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 1000 total points
ID: 34975673

you can use a set of three conditional formatting rules with the "Stop if True" clicked in the Conditional format manager. Place the rules in the right order, then you can use these three formulas, one for each rule:


The fourth colour could be achieved with a fourth rule or by simply setting the default color for the cells.

cheers, teylyn
LVL 50
ID: 34975694
see attached with 4 rules. Change colors to your liking.

cheers, teylyn

Author Comment

ID: 34975813
Thanks! That seems to work fine and I was able to change colors as needed. However, I will be making several (~50-70) of these charts. Is there any way to import/export/save these rules to transfer to a new table? My thought with asking if there was an IF/THEN statement that can handle this is that the statement could then be copied from sheet to sheet.
I Suppose if there isn't a way to copy the rules from sheet to sheet I can use the one you've set up as a working sheet and then copy from there to the final destination
LVL 50
ID: 34975867

you can copy B4, then select the new table and use Paste Special - Formats. That will apply the same rules to another range of cells.

cheers, teylyn

Author Comment

ID: 34981037
Awesome that was very helpful!

Featured Post

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!

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…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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