+ Reply to Thread
Results 1 to 19 of 19

Extracting Font Color from a Conditionally Formatted Cell

  1. #1
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Extracting Font Color from a Conditionally Formatted Cell

    Hey,

    I'm trying to determine the color of a conditionally formatted cell, without using the conditions. All the color functions I've found only look at the original cell font color. I'm using Excel 2002, by the way. Thanks.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Extracting Font Color from a Conditionally Formatted Cell

    It requires VBA, and it's not trivial.

    How about instead computing the conditional formatting formula in a cell, and then using the result of that to both control the font color and for whatever other purpose you now require?

    If you want the VBA route, see http://www.cpearson.com/excel/CFColors.htm
    Last edited by shg; 03-26-2010 at 07:01 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    Well I'm programming my own NCAA bracket that colors the bracket appropriately, and the problem with using the conditions is that they'll have to be nested I feel so when I get to final, the formula will be very complex, so I was hoping for some kind of recursion, maybe. I'm new to excel, so not sure if I'm using all the right lingo. If you need more information, let me know.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Extracting Font Color from a Conditionally Formatted Cell

    I'd have thought the CF would be pretty straightforward, but haven't thought it through.

    In any case, you have the only two suggestions I have.

  5. #5
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    I'm trying to us the link you sent me, but I keep getting a #NAME? when I try to use the functions. I'm not too familiar with VBA but I saved the code as a module, but it isn't working. Any suggestions?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Extracting Font Color from a Conditionally Formatted Cell

    This code by Chip Pearson?
    Please Login or Register  to view this content.
    Adding a Macro to a Code Module
    1. Copy the code from the post
    2. Press Alt+F11 to open the Visual Basic Editor (VBE)
    3. From the menu bar in the VBE window, do Insert > Module
    4. Paste the code in the window that opens
    5. Press Alt+Q to close the VBE and return to Excel

    In a cell, =ColorIndexOfCF(A1, TRUE)

    If you're new to VBA, I don't think this is a great place to jump in.
    Last edited by shg; 03-26-2010 at 07:18 PM.

  7. #7
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    I'm still getting the same error. It seems like Excel isn't recognizing the function as a valid function, or doesn't like the arguments I am giving to it. I know it's pretty advanced, but I have a decent knowledge of other programming languages, so only the syntax I'm having trouble with

  8. #8
    Registered User
    Join Date
    03-26-2010
    Location
    Setubal, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Extracting Font Color from a Conditionally Formatted Cell

    Check GetFontColor function on my blog here:

    http://excel-user.blogspot.com/2009/...-function.html

    jppinto

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Extracting Font Color from a Conditionally Formatted Cell

    Post the workbook.

  10. #10
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    Just look at sheet 3, and if you follow basketball, once you get a game wrong I want that team to be crossed out for the rest of the rounds. So basically I want to check if a cell is red, if I can do that my problems are solved. If you have any questions about it, I'll try and answer them.

    Thanks for your help!
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    the functions say they take no arguments. This is why I'm at an impasse.

  12. #12
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Extracting Font Color from a Conditionally Formatted Cell

    You have a couple of problems:
    1. You are missing the GetStrippedValue function from that page.
    2. You have the same functions repeated in three modules which is confusing Excel.
    3. You are running into the limitation mentioned on Chip's site, namely that you are using the function on a worksheet and you are using relative references in the CF formula. It will not work properly under those conditions.
    Remember what the dormouse said
    Feed your head

  13. #13
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    1. Where can I get the GetStripped Value from?
    3. What do these terms mean and how to a reference a cell properly?

  14. #14
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Extracting Font Color from a Conditionally Formatted Cell

    Quote Originally Posted by jppinto View Post
    Check GetFontColor function on my blog here:
    jppinto, this is about conditionally formatted cells.

  15. #15
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    @romperstomper

    I fixed 1. and 2. but not sure how to fix 3. I know I have to use the $ signs, but it still won't work

  16. #16
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    I know I've gotten a lot of great help, which I'm very thankful for, but can anyone help me get through these last couple bugs?

  17. #17
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Extracting Font Color from a Conditionally Formatted Cell

    rsromano, could you exercise some patience, please? You started this thread a mere three hours ago and have already received excellent advice from our leading VBA wizards.

    Quote Originally Posted by romperstomper
    3. You are running into the limitation mentioned on Chip's site, namely that you are using the function on a worksheet and you are using relative references in the CF formula. It will not work properly under those conditions.
    Did you read this?

    If it is that complex, you will not get instant resolution, no matter how hard you push.

  18. #18
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Extracting Font Color from a Conditionally Formatted Cell

    Did you alter the conditional formatting formulas to use absolute references?

  19. #19
    Registered User
    Join Date
    03-26-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Extracting Font Color from a Conditionally Formatted Cell

    @teylyn: sorry if I sounded pushy, I was just updating you guys on my progress. I've received more help than I ever expected, and faster than I thought possible, and I'm very thankful for it.

    @romperstomper: So I need to change every cell to absolute. Is there a quick way to do this? Like a mass change, instead of changing each one individually? I know F4 can change a reference to absolute.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1