MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 24th, 2002, 12:11 PM   #1
gresple
New Member
 
Join Date: Apr 2002
Location: Hong Kong
Posts: 5
Default

Can I have more than 3 conditions for the conditional formatting function?
gresple is offline   Reply With Quote
Old Apr 24th, 2002, 12:16 PM   #2
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-04-24 11:11, gresple wrote:
Can I have more than 3 conditions for the conditional formatting function?
No. There is some VBA code at this site that allows for more conditions. Try to use Search facility of the site if interested.
Aladin Akyurek is offline   Reply With Quote
Old Apr 24th, 2002, 12:22 PM   #3
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Quote:
On 2002-04-24 11:11, gresple wrote:
Can I have more than 3 conditions for the conditional formatting function?
You can have a compound condition involving more than 3 conditions that apply a single format. So, yes, strictly speaking you can have more 3 conditions, but you're constrained by number of formats (3) that can be applied with Excel's Conditional Formatting menu command.

[ This Message was edited by: Mark W. on 2002-04-24 11:23 ]
Mark W. is offline   Reply With Quote
Old Apr 24th, 2002, 01:31 PM   #4
lenze
MrExcel MVP
 
lenze's Avatar
 
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
Default

Actually, depending on the type of conditions you have, you may be able to trick excel into giving you more formats by combining custom formatting with conditional formatting. As an example

Say you want the following formatting for a range of cells

Value Color
<5 Black
5-9 Green
10-14 Blue
15-19 Cyan
20-24 Purple
25+ Red

Select your range and Under format, choose custom and enter [<5][Black]0;[<10][Green]0;[<15][Blue]0

Now under conditional formatting enter

Condition 1 Cell Value >=25 Format Red
Condition 2 Cell Value >=20 Format Purple
Condition 3 Cell Value >=15 Format Cyan

This will give you 6 conditional formats for your range.
lenze is offline   Reply With Quote
Old May 1st, 2002, 03:02 PM   #5
fb250r
Board Regular
 
Join Date: Apr 2002
Posts: 104
Default

It's not working. It does not like the formula.
fb250r is offline   Reply With Quote
Old May 1st, 2002, 07:37 PM   #6
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,385
Default

You can do this with VBA as Aladin, Mark, and lenze suggested. Here is a simple example, although your question was not clear as to whether your data is numeric, text, dates, etc. This code uses a select case structure for cell A1's interior color index (cell shading), depending on what number is entered into A1. You can expand the conditions as needed.

Right click on your sheet tab, left click on View Code, and paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Or Target.Cells.Count > 1 Then Exit Sub
Select Case [A1].Value
Case 1
Target.Interior.ColorIndex = 3
Case 2
Target.Interior.ColorIndex = 6
Case 3
Target.Interior.ColorIndex = 8
Case 4
Target.Interior.ColorIndex = 22
Case 5
Target.Interior.ColorIndex = 25
Case Else
Target.Interior.ColorIndex = 15
End Select
End Sub

Is this any help for what you were requesting?
__________________
Tom Urtis
Microsoft MVP - Excel
Tom Urtis is offline   Reply With Quote
Old Oct 12th, 2006, 05:23 AM   #7
billyboyuk2000
Board Regular
 
Join Date: Apr 2005
Posts: 52
Default following on from formatting question

Right the VBA code works a treat..thanks for that.

Instead of keying in "SB" = colour on the VBA code could it be linked to cell references so you opnly have to change the "SB" to a "BA" and it'll still change colour?

Hope that makes sense?
billyboyuk2000 is offline   Reply With Quote
Old Nov 7th, 2006, 04:32 AM   #8
ballbugsbunny
New Member
 
Join Date: Nov 2006
Posts: 1
Default

I need to be able to colour a row depending on the value of the element in the first column of the row. I need 4 different colours and with excel's capabilities i can only have 3 colours. So i need to have a vb part. It needs to be dynamic though.. Values are numeric and text strings. Can you inform me about the function that colours the whole row? and something else.. Inside the case function what is the dynamic declaration of the row? It my first time with excel..
Thanx
ballbugsbunny is offline   Reply With Quote
Old Jan 16th, 2007, 02:09 PM   #9
Ian Betteridge
Board Regular
 
Join Date: Mar 2006
Posts: 443
Default

Hi Lenze,
Just reading your reply, can you tell me where the custom is on format.
You wrote:
Select your range and Under format, choose custom and enter

Thanks Ian
Ian Betteridge is offline   Reply With Quote
Old Jan 21st, 2007, 07:20 PM   #10
lenze
MrExcel MVP
 
lenze's Avatar
 
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
Default

Hi:

It's under Format>Cells on the Number Tab. It's one of the options in the category list. When you select it, enter the formula in the Type field.

lenze
__________________
If you have to tell your boss you're good with Excel, you're NOT!!
All I know about Excel I owe to my ignorance!
Scotch: Because you don't solve great Excel problems over white wine
lenze is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:43 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes