Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Conditional Formatting

How to include more than 3 conditions for formatting the cell ?
For example: if the cell values are A, B, C, D or E, the cell displays in a
designated format.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Conditional Formatting

If you do mean that you want one designated format if the cell value is A,
B, C, D, or E, then you can use an OR function in your conditional
formatting condition. Use Formula Is, not Cell Value Is.
--
David Biddulph

"yclhk" wrote in message
...
How to include more than 3 conditions for formatting the cell ?
For example: if the cell values are A, B, C, D or E, the cell displays in
a
designated format.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 273
Default Conditional Formatting

I use a For-Next loop for this.

Place code behind worksheet -

Presumes your data is in Column G, rows 2-500

For rwIndex = 2 To 500
For colIndex = 6 To 6
With Worksheets("Your Tab Name").Cells(rwIndex, colIndex)
If .Value = "A" Then
.Font.ColorIndex = 3
Else
If .Font.ColorIndex = B Then
.Font.ColorIndex = 4
Else

End If
End If
End With
Next colIndex
Next rwIndex


hth

"yclhk" wrote:

How to include more than 3 conditions for formatting the cell ?
For example: if the cell values are A, B, C, D or E, the cell displays in a
designated format.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Conditional Formatting

You could use event code to get more than 3 formats for a cell.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Range
Set vRngInput = Intersect(Target, Range("A1"))
If vRngInput Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
For Each rng In vRngInput
'Determine the color
Select Case UCase(rng.Value)
Case Is = "A": Num = 10 'green
Case Is = "B": Num = 1 'black
Case Is = "C": Num = 5 'blue
Case Is = "D": Num = 7 'magenta
Case Is = "E": Num = 46 'orange
Case Is = "F": Num = 3 'red
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste the code into that sheet module. Alt + q to go back to Exel window.

Adjust range and colors to suit.


Gord Dibben MS Excel MVP

On Wed, 19 Dec 2007 08:56:01 -0800, yclhk
wrote:

How to include more than 3 conditions for formatting the cell ?
For example: if the cell values are A, B, C, D or E, the cell displays in a
designated format.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Conditional Formatting

Thanks for all. I think the solution of using OR function is more simple.
However, how to compose the formula in this formatting ?

Thanks again for your help,

"David Biddulph" wrote:

If you do mean that you want one designated format if the cell value is A,
B, C, D, or E, then you can use an OR function in your conditional
formatting condition. Use Formula Is, not Cell Value Is.
--
David Biddulph

"yclhk" wrote in message
...
How to include more than 3 conditions for formatting the cell ?
For example: if the cell values are A, B, C, D or E, the cell displays in
a
designated format.






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 364
Default Conditional Formatting

For conditionally formatting cell A1, use
=OR(A1="A",A1="B",A1="C",A1="D",A1="E")

"yclhk" wrote in message
...
Thanks for all. I think the solution of using OR function is more simple.
However, how to compose the formula in this formatting ?

Thanks again for your help,

"David Biddulph" wrote:

If you do mean that you want one designated format if the cell value is
A,
B, C, D, or E, then you can use an OR function in your conditional
formatting condition. Use Formula Is, not Cell Value Is.
--
David Biddulph

"yclhk" wrote in message
...
How to include more than 3 conditions for formatting the cell ?
For example: if the cell values are A, B, C, D or E, the cell displays
in
a
designated format.






  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Conditional Formatting

Thanks to Stephen, it works.

"Stephen" wrote:

For conditionally formatting cell A1, use
=OR(A1="A",A1="B",A1="C",A1="D",A1="E")

"yclhk" wrote in message
...
Thanks for all. I think the solution of using OR function is more simple.
However, how to compose the formula in this formatting ?

Thanks again for your help,

"David Biddulph" wrote:

If you do mean that you want one designated format if the cell value is
A,
B, C, D, or E, then you can use an OR function in your conditional
formatting condition. Use Formula Is, not Cell Value Is.
--
David Biddulph

"yclhk" wrote in message
...
How to include more than 3 conditions for formatting the cell ?
For example: if the cell values are A, B, C, D or E, the cell displays
in
a
designated format.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
Conditional Formatting RBG Excel Worksheet Functions 3 August 17th 07 07:00 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"