Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 12-05-2009, 09:37 AM
e4excel e4excel is offline
Registered User
 
Join Date: 03 Nov 2008
Location: India
MS Office Version:Totally Confused with 2007
Posts: 397
e4excel will soon become part of the community
Does Conditional Formatting apply to each Character in a Cell?

Please Register to Remove these Ads

Dear Forum,

I am trying to do a very simple Task of employing conditional Formatting in a Cell $B$2 which contains the following letters i.e characters.. [ A B C D E ]

They are coloured as follows :

A B C D E and this cell is filled with BLACK Fill Colour

Now If I enter 1 in the Cell $A$2, then the same colour scheme should remain in the Cell $B$2 but if I enter 2 then the formatting should change to BLUE FIll Colour and the Text to Yellow...

But when I tried changing the value in the Cell A2 to 2 , then only the first letter i.e "A" changes to Yellow Colour while rest does not change its colour i.e. remain the same...

Why is the entire cell B2 not getting formatted with all the contents?
And what is the remedy for the same?

Warm Regards
e4excel

Last edited by e4excel; 12-05-2009 at 01:58 PM. Reason: Spelling Mistakes
Reply With Quote
  #2  
Old 12-05-2009, 06:24 PM
teylyn's Avatar
teylyn teylyn is offline
Forum Moderator
 
Join Date: 28 Oct 2008
Location: German in New Zealand
MS Office Version:2000 - 2010
Posts: 4,673
teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay
Re: Does Conditional Formatting apply to each Character in a Cell?

I assume that A is formatted with the default cell's formatting, and the other letters are formatted individually in the formula editing box.

Conditional formatting will only cange the default format of a cell, so the individual color formats you have set manually for the other letters will override CF.

hth
__________________
teylyn
If you want to say Thank you to a member, click the reputation icon in the title bar of the post you liked
Everyone needs a pat on the back every once in a while!
...How to Cross-post politely...
Things I do with the right side of my brain ...
Reply With Quote
  #3  
Old 12-06-2009, 02:20 PM
e4excel e4excel is offline
Registered User
 
Join Date: 03 Nov 2008
Location: India
MS Office Version:Totally Confused with 2007
Posts: 397
e4excel will soon become part of the community
Re: Does Conditional Formatting apply to each Character in a Cell?

Quote:
Originally Posted by teylyn View Post
I assume that A is formatted with the default cell's formatting, and the other letters are formatted individually in the formula editing box.
I have formatted individually to "purple" colour so when there's 1 in F1 "A" remains the same i.e Purple however when I cahnge the value F1=2 then only "A" changes to Blue while rest of the Letters BCDE reamin unchanged..

Quote:
Conditional formatting will only cange the default format of a cell, so the individual color formats you have set manually for the other letters will override CF.
Is there a way of overriding the same or an you suggest a workaround...
Reply With Quote
  #4  
Old 12-06-2009, 02:34 PM
teylyn's Avatar
teylyn teylyn is offline
Forum Moderator
 
Join Date: 28 Oct 2008
Location: German in New Zealand
MS Office Version:2000 - 2010
Posts: 4,673
teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay
Re: Does Conditional Formatting apply to each Character in a Cell?

Unless you want to involve VBA, there is probably no native Excel solution for this.

My suggestion is to split the different colored elements out into separate columns, use the default formatting to format each cell and apply conditional formatting to change it.

hth
__________________
teylyn
If you want to say Thank you to a member, click the reputation icon in the title bar of the post you liked
Everyone needs a pat on the back every once in a while!
...How to Cross-post politely...
Things I do with the right side of my brain ...
Reply With Quote
  #5  
Old 12-06-2009, 02:58 PM
e4excel e4excel is offline
Registered User
 
Join Date: 03 Nov 2008
Location: India
MS Office Version:Totally Confused with 2007
Posts: 397
e4excel will soon become part of the community
Re: Does Conditional Formatting apply to each Character in a Cell?

Ok thanks a lot Tevelyn got my answer that its not possible in Excel as I was unsure about that...!

However if were to involve VBA , can you please add an attachment for the same..

I had though of bifurcating the characters in Multiple cells but as per the existing design of the present workbook it won't be feasible..

Would appreciate if you could come up with something via VBA which is not my CUp of Tea at all..

Please provide explantions wherever neccessary as I do not get VBA very easily but off late have started using it more frequently with the Forum's help...

Thanks a lot for the confirmation ANyways..
Reply With Quote
  #6  
Old 12-06-2009, 03:04 PM
teylyn's Avatar
teylyn teylyn is offline
Forum Moderator
 
Join Date: 28 Oct 2008
Location: German in New Zealand
MS Office Version:2000 - 2010
Posts: 4,673
teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay
Re: Does Conditional Formatting apply to each Character in a Cell?

Quote:
can you please add an attachment for the same
Sorry, my VBA is too basic to do stuff like that. Maybe start a new thread in the programming forum and explain that you want to programatically format parts of a text string based on conditions.

hth
__________________
teylyn
If you want to say Thank you to a member, click the reputation icon in the title bar of the post you liked
Everyone needs a pat on the back every once in a while!
...How to Cross-post politely...
Things I do with the right side of my brain ...
Reply With Quote
  #7  
Old 12-07-2009, 01:26 AM
mikerickson mikerickson is offline
Forum Moderator
 
Join Date: 30 Mar 2007
Location: Davis CA
MS Office Version:Excel 2004
Posts: 2,322
mikerickson is very confident of their ability mikerickson is very confident of their ability mikerickson is very confident of their ability
Re: Does Conditional Formatting apply to each Character in a Cell?

You could put this in the sheet's code module.
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim i As Long
    If Not Application.Intersect(Target, Range("A2:B2")) Is Nothing Then
        Application.EnableEvents = False
        Application.ScreenUpdating = False
        With Range("B2")
            If Val(CStr(Range("A2").Value)) <> 2 Then
                For i = 1 To .Characters.Count
                    With .Characters(i, 1)
                        Select Case .Text
                            Case "A"
                                .Font.Bold = True
                                .Font.ColorIndex = 54
                            Case "B"
                                .Font.Bold = True
                                .Font.ColorIndex = 3
                            Case "C"
                                .Font.Bold = True
                                .Font.ColorIndex = 44
                            Case "D"
                                .Font.Bold = True
                                .Font.ColorIndex = 13
                            Case "E"
                                .Font.Bold = True
                                .Font.ColorIndex = 14
                            Case Else
                                .Font.Bold = False
                                .Font.ColorIndex = xlAutomatic
                        End Select
                    End With
                Next i
                .Interior.ColorIndex = 1
            Else
                For i = 1 To .Characters.Count
                    With .Characters(i, 1)
                        .Font.Bold = False
                        .Font.ColorIndex = 6
                    End With
                Next i
                .Interior.ColorIndex = 5
            End If
        End With
        Application.ScreenUpdating = True
        Application.EnableEvents = True
    End If
End Sub
__________________
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
Reply With Quote
  #8  
Old 12-07-2009, 04:28 AM
e4excel e4excel is offline
Registered User
 
Join Date: 03 Nov 2008
Location: India
MS Office Version:Totally Confused with 2007
Posts: 397
e4excel will soon become part of the community
Re: Does Conditional Formatting apply to each Character in a Cell?

Dear Mick,

I have tried using your code in my file but I am not sure whether am I using it correctly as Im no good in VBA.

Nothings happening as in there's nothing new happening..
I wil attach the file you can check and let me know...

Thanks..
Attached Files
File Type: xls CF.xls (24.0 KB, 2 views)
Reply With Quote
  #9  
Old 12-07-2009, 04:57 AM
pike's Avatar
pike pike is offline
Forum Guru
 
Join Date: 11 Dec 2005
Location: Moruya, Australia
MS Office Version:2007
Posts: 1,548
pike is a becoming a god in the Excel Forum World pike is a becoming a god in the Excel Forum World pike is a becoming a god in the Excel Forum World pike is a becoming a god in the Excel Forum World pike is a becoming a god in the Excel Forum World pike is a becoming a god in the Excel Forum World
Re: Does Conditional Formatting apply to each Character in a Cell?

mike is off line but
place the code in the "VBAProject" "Microsoft Excel Objects" "sheet1"
click on the work sheet1 and place the code
(same as you have done in module1)
__________________
.

regards pike

Always add code tags to your VBA script [code] .Range("A1:A10").RemoveDuplicates [/code]
Code:
 .Range("A1:A10").RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
Remember to change the prefix to [SOLVED]
If the solution helped and you wish to add to the contributors reputation, click the.... .... icon in top right hand corner of the thread ......... ã
Spreadsheet Toolbox
Reply With Quote
  #10  
Old 12-07-2009, 08:41 AM
e4excel e4excel is offline
Registered User
 
Join Date: 03 Nov 2008
Location: India
MS Office Version:Totally Confused with 2007
Posts: 397
e4excel will soon become part of the community
Re: Does Conditional Formatting apply to each Character in a Cell?

Dear Pike,

Thanks for the update, I knew that I was doing something wrong but am not good enough to even know that in VBA..
However, though its working it turns completely blue after I enter 2 in A2 and does not show any text in B2..Please tell me what am i supposed to do about that?

Just had a very quicjk question how many colours are there in Excel available to format..?
Reply With Quote
  #11  
Old 12-07-2009, 02:59 PM
teylyn's Avatar
teylyn teylyn is offline
Forum Moderator
 
Join Date: 28 Oct 2008
Location: German in New Zealand
MS Office Version:2000 - 2010
Posts: 4,673
teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay
Re: Does Conditional Formatting apply to each Character in a Cell?

Quote:
how many colours are there in Excel available to format
56 in Excel 2003, but you can change the default color palette. Gazillions in 2007.
__________________
teylyn
If you want to say Thank you to a member, click the reputation icon in the title bar of the post you liked
Everyone needs a pat on the back every once in a while!
...How to Cross-post politely...
Things I do with the right side of my brain ...
Reply With Quote
  #12  
Old 12-08-2009, 12:27 AM
e4excel e4excel is offline
Registered User
 
Join Date: 03 Nov 2008
Location: India
MS Office Version:Totally Confused with 2007
Posts: 397
e4excel will soon become part of the community
Re: Does Conditional Formatting apply to each Character in a Cell?

Quote:
Originally Posted by teylyn View Post
56 in Excel 2003, but you can change the default color palette. Gazillions in 2007.
Thanks Tevelyn,

I was not sure about the range, anyways I use 2003 I would be limited to 56..

Dear Forum,

If someone can check the attachemnt and lemme know as to what changes I need to make then it would be great..!

Regards
Reply With Quote
  #13  
Old 12-08-2009, 09:22 AM
mikerickson mikerickson is offline
Forum Moderator
 
Join Date: 30 Mar 2007
Location: Davis CA
MS Office Version:Excel 2004
Posts: 2,322
mikerickson is very confident of their ability mikerickson is very confident of their ability mikerickson is very confident of their ability
Re: Does Conditional Formatting apply to each Character in a Cell?

Putting the code in the Sheet1 code module and removing the CF from B2 should fix things.
Attached Files
File Type: zip CF2.xls.zip (10.6 KB, 2 views)
__________________
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.

Last edited by mikerickson; 12-08-2009 at 10:27 AM.
Reply With Quote
  #14  
Old 12-08-2009, 11:35 AM
darkyam's Avatar
darkyam darkyam is offline
Forum Guru
 
Join Date: 05 Mar 2008
Location: Virginia, US
MS Office Version:2007
Posts: 1,679
darkyam is very confident of their ability darkyam is very confident of their ability darkyam is very confident of their ability darkyam is very confident of their ability
Re: Does Conditional Formatting apply to each Character in a Cell?

Quote:
Originally Posted by teylyn View Post
Gazillions in 2007.
Technically, only 16,777,216. Each of the three main colors has 256 shades recognized, so it's 256^3. Don't really know why they have so many, though. I think it's one of those changes they made more because they could than because people demanded millions of colors.
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump