Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing a cell background colour if a criteia is met

Status
Not open for further replies.

sdelacey

Vendor
Jul 2, 2003
12
GB
Good Evening Guys

Can anybody help. I have tried conditional formating but I can't seem to get it to work.

What I am trying to do is if a certain cell in column A contains the number 45684 then the next cell in column B can have the back ground colour changed, but I need to do this with about 50 different criteias,

I haved used a vlookup to get the results in column B if thats makes a difference

therefore 55 will have a yellow cell, and 86 will have a red cell

45684 55
25273 86

Cheers Guys

Steph
 
Steph,
Let's suppose that you have a table with fifty different criteria that result in one of three different colors. The color depends on the value in the second column--which contains 1, 2, or 3. You could then use a VLOOKUP formula in your Conditional Formatting.

Suppose that A1:B50 is your table of criteria. Column A contains the criteria values, while column B contains the color. If cell C1 is to be tested, and the Conditional Formatting highlight applied to cell D1, then:
1) Select D1 and open the Format....Conditional Formatting menu item
2) Select "Formula is" and use the following formula:
=VLOOKUP($C$1,$A$1:$B$50,2,FALSE)=1
3) Click the Format button, then the Patterns tab and select the highlight color
4) Click the Add button, choose "Formula is" and enter the following as your second formula:
=VLOOKUP($C$1,$A$1:$B$50,2,FALSE)=2
5) Click the Add button, choose "Formula is" and enter the following as your third formula:
=VLOOKUP($C$1,$A$1:$B$50,2,FALSE)=3
6) Click OK

Test the Conditional Formatting by entering various values in cell C1. If there is a match to column A, then the value in column B will be returned--thereby setting the color. If there is no match (or if column B contains somehting other than 1, 2 or 3), then cell D1 will remain white (no highlight color).
Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top