Solved

If/Then to color in a cells based on classes

Posted on 2011-02-24
5
211 Views
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!
 
 TH-Def-SM-Corr.xlsx
0
Comment
Question by:dougf1r
  • 3
  • 2
5 Comments
 
LVL 50

Accepted Solution

by:
teylyn earned 250 total points
Comment Utility
Hello,

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:

=abs(B4)>=0.9
=abs(B4)>=0.75
=abs(B4)>=0.5

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

cheers, teylyn
0
 
LVL 50

Expert Comment

by:teylyn
Comment Utility
see attached with 4 rules. Change colors to your liking.

cheers, teylyn
Copy-of-TH-Def-SM-Corr.xlsx
0
 
LVL 1

Author Comment

by:dougf1r
Comment Utility
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
0
 
LVL 50

Expert Comment

by:teylyn
Comment Utility
Hello,

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
0
 
LVL 1

Author Comment

by:dougf1r
Comment Utility
Awesome that was very helpful!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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 in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

744 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

18 Experts available now in Live!

Get 1:1 Help Now