+ Reply to Thread
Results 1 to 6 of 6

IF statement using formatting criteria (NOT conditional formatting)

  1. #1
    Registered User
    Join Date
    03-06-2009
    Location
    Nebraska City, NE
    MS-Off Ver
    Excel 2007
    Posts
    30

    Question IF statement using formatting criteria (NOT conditional formatting)

    Is there "code" for different formatting in a spreadsheet so you can use an IF statement to do something like:

    if(A1=blue background,"Yes","No")

    or

    if(A1=red text,"Yes","No")

    etc.?? But replace "blue background" and "red text" with some sort of number code? I want to compile a list of the items that are formatted with certain background colors and/or text colors and then organize only those items into a chart.
    Last edited by chelseasikoebs; 05-07-2009 at 06:36 PM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: IF statement using formatting criteria (NOT conditional formatting)

    Hi,

    You'll need a user defined function to do this.

    Foe example,

    Please Login or Register  to view this content.
    This will return the value of the fill colour of A1.

    =FILLCOLOUR(A1)
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    03-06-2009
    Location
    Nebraska City, NE
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: IF statement using formatting criteria (NOT conditional formatting)

    then would I put in a formula like this to get it to work?:

    =IF(K1=fillcolour(A1),"yes it's the same color","no it's not the same color")

  4. #4
    Registered User
    Join Date
    03-06-2009
    Location
    Nebraska City, NE
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: IF statement using formatting criteria (NOT conditional formatting)

    oh, wait. once I have the value of the fill color, then I can use THAT in a function? Such as:

    =if(k1=-4701,"yes it's the same color","no it's not the same color")

  5. #5
    Registered User
    Join Date
    03-06-2009
    Location
    Nebraska City, NE
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: IF statement using formatting criteria (NOT conditional formatting)

    oh my gosh, I'm sorry. I'm playing with it more now and I see how to use it! THANKS SOOOO MUCH!!!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF statement using formatting criteria (NOT conditional formatting)

    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED].




    (Also, use the "scales" icon across from the post dates to leave Feedback, it is appreciated)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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