+ Reply to Thread
Results 1 to 17 of 17

search, compare, and copy color of another cell

  1. #1
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    search, compare, and copy color of another cell

    Hello,

    I have two dynamic tables.

    Table 1 gets its values from several other sheets, and is spread to 8 columns, but each column has a separate color that is always constant.

    Table 2 gets its values from Table 1, but changes the order in different columns.

    I need a formula for the conditional formatting option that says something to the effect of: Find the value of this cell (from table 2) in Table 1, and mimic its color.

    Is this possible?

    Thanks in advance,

    Jona

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: search, compare, and copy color of another cell

    no, CF cannot mimic color, but what you might ba able to do is use the same formula from the original CF, to set the color for the 2nd CF?

    dit: well, at least in 2007, it cant, i dont have 2010, so i cant say for sure
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    i'm not sure what you mean by using "the original CF to set the color for the 2nd CF" - there is no conditional formatting as of yet. Table 1 is just colored in a constant way.

    thanks though

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: search, compare, and copy color of another cell

    ok, what defines or creates the colors in table 1? if that is through CF, then could you use those rules for table 2?

  5. #5
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    table 1 i just highlight each column, and choose a color. no conditional formatting

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: search, compare, and copy color of another cell

    bummer

    what is the basis of your choice of color? could that be done through CF for table 1?

  7. #7
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    lol unfortunately no, it's just... just a color to differentiate from the other columns.

    the problem is that in Table 2 the exact same values of Table 1 are present, but in smaller, separated tables, so 1 formula couldn't work for both tables, even if Table 1 had CF.

    looks like this has no solution :/

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: search, compare, and copy color of another cell

    I have seen this done using VBA, but my VBA sucks I will ask around, so dont give up just yet

  9. #9
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    thanks man, i appreciate it =)

    i'm going to bed for now, hopefully the morning will bring better fortunes :P

    goodnight, and happy new year

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

    Re: search, compare, and copy color of another cell

    One of the first lessons I learned here on the forum, a hard one, too, was that "color is not data". Think about that.

    Color is for human reference, it's not a piece analyzable or referencable data. Anytime you are about to manually apply a color to a cell, STOP. Ask yourself why you're doing it and see if you can replace that action with a new piece of REAL data you add to that same row of data. Perhaps a new column that adds a category that instructs that same differentiation you were about to do with a color.

    Putting the word "Green" in a new column, that's data. Coloring a cell green for visual reference, that's not data.

    So, I will help you with your project but you will need to consider this first. I'm not interested in helping you further develop a bad habit by constructing VBA to try and analyze your manual colorations when you can add actual data instead that would make your further analysis of the original data much simpler and meaningful.
    _________________
    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!)

  11. #11
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    JBeaucaire,

    Thank you, I do understand that computers have their limitations, and I can appreciate that.

    Thankfully, I woke up with a slight revelation for a VBA-less solution. Maybe you can help me out a little

    Since Table 1 only has 6 columns, and each column is assigned a color regardless of what value is in there, I can do something in the vein of:

    IF(B4 [[from table 2]] = ANY VALUE IN COLUMN 1 from TABLE 1), then RED
    IF(B4 [[from table 2]] = ANY VALUE IN COLUMN 2 from TABLE 1), then GREEN
    etc until column 6

    and then i may have to do it manually for every cell in table 2, but it's do-able!

    if you could advise me whether I'm right // what formula i should be using in the conditional formatting box, i'd appreciate it!

    thanks in advance
    Last edited by Jona2491; 01-02-2013 at 10:57 AM.

  12. #12
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256

    Re: search, compare, and copy color of another cell

    Ask the VBA forum for advice.
    //Ola


    To read a cell color:
    Insert a separate Row. Then write this formula =CellColor(A2) and copy the formula to the right.
    To make the =CellColor(A2) function work: Alt+F11 > Insert Module > Copy and paste the below VBA-code:

    Please Login or Register  to view this content.
    To fill a cell with a color:
    Ask the VBA forum or follow this link.
    Mark the problem as Solved under the Yellow bar up Top right, under Thread Tools, when you received a solution.
    It saves time, to skip already solved threads.

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: search, compare, and copy color of another cell

    @ JB i LOVE the explanation about color, very well explained

    @ Jona CF cannot, by itself, reference another sheet (well, 2007 cant, anyway). so what you will have to do for that, is on the sheet with table 2, reference those values from table 1. then on table 2, you can use CF to change the color

  14. #14
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    Um, thanks guys.. but as I said, i found a non-VBA solution.

    and FDibbins - both tables are one 1 sheet, so that's not even a problem.

    my solution is a little daunting and time consuming, but it works.

    anyone know how to make CF look for any value in a column? right now i'm forced to use a very long OR statement :/

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

    Re: search, compare, and copy color of another cell

    If you were to give a NAMED RANGE to the column 1 of table 1, perhaps name it CLMN1 and then give then CLMN2 to the second column of table 1, you would then be able to use Conditional Formatting in table2 to color.

    =COUNTIF(CLMN1, B4)>0 (color red)

    =COUNTIF(CLMN2, B4)>0 (color green)


    =====================

    If the tables are truly in the same page, then you can use the COUNTIF formulas without named ranges.

  16. #16
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    JB you are clearly very knowledgeable and that COUNTIF works splendidly.

    if you can give a solution to the following, I will conjure for you an even more admirable title:

    any way to autofill conditional formatting? B4 is the same cell, i want to apply the exact same conditional formatting to the 6 cells below it, and the other 7 mini-tables

    thanks a bunch!

  17. #17
    Registered User
    Join Date
    12-15-2012
    Location
    Miami, FL
    MS-Off Ver
    Microsoft 2010
    Posts
    28

    Re: search, compare, and copy color of another cell

    nevermind! got it

    So here's what I did, for future users:


    highlight the entire column in table 2

    conditional formatting - new rule - use formula

    =COUNTIF($F$5:$F$10, $J5)

    format to color red

    ok

    then i did the same, but for the different corresponding columns and colours

    it works!

    thanks to all that helped! JB especially!

+ 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