+ Reply to Thread
Results 1 to 9 of 9

Changing color based on set of predetermined values

  1. #1
    Registered User
    Join Date
    10-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Changing color based on set of predetermined values

    This is (I think) a very basic problem. I will try to explain to the best of my ability.

    I have a database (small) that lists values of a certain heading by row. I have 6 total rows. I would like the first row, ROW(A) to mimic the data value of ROW(E) and then display only a color based on the value of ROW(E). here is my partial solution and an example for what I have done and would like to see in ROW(A):

    I have formatted COLUMN(A) to a custom text format ;;; and assigned A2 to the same value as E3 and then drug the box from A2:An where An represents my last value in COLIMN(A). So now my numerical values for A match those for the corresponding E column for every ROW. I have then attempted to format Column A for specific values. For instance

    Conditional Formatting/Manage Rules/New Rule/Use a formula to determine which cells to format/

    I then enter formulas like this one "=-500 > E2 > -1000" THEN color the cell light magenta
    and this one "= 0 <= E2 <= 200" THEN color the cell pastel orange

    The problem is that this type of formatting only applies one cell in COLUMN(A) to the corresponding value in COLUMN(E). I would like each ROW(A) to identify with the corresponding ROW(E) and format the background color of COLUMN(A) accordingly. This way when I look at COL(A) I can tell where it lies immediately on the scale. I will have 6-8 pre-determined colors for COL(A). I would use the pre-defined color scale, but I have large positives and negatives that I would like custom colors for and they do not fall on the three color scale that is implemented automatically in Excel. As I said, I can make the values in A transparent and assign corresponding values of A to E, so all I really need now is a generic way to color cells by value since the values are now hidden. I don't mind making 6-8 lines of qualifiers, but I want to be able to assign all qualifiers to each and every cell in A and have the color change based on A's value.

    Also, I used this type of formula (=A2>2000) to assign a color to A2, thinking that I might find a way to apply it generically to all of A, but it actually changes the background color for A1 and I have no idea why.

    Thank you for any help that you might provide,

    Brad

  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,939

    Re: Changing color based on set of predetermined values

    Hi and welcome to the forum

    It would be easier to help if you upload a (clean) small sample workbook showing examples of what you are working with, and what your expected outcome would be.

    However, looking at what uyou have above, a few comments...
    if your rules really look like you showed...
    "=-500 > E2 > -1000"
    1. you need to remove the ""
    2. to compare data within a range, use AND()
    =and(E2<-500,E2>-1000)

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Changing color based on set of predetermined values

    they should be
    =AND($E2>=0,$E2<=200)
    =AND($E2<-500,$E2>-1000)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    10-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Changing color based on set of predetermined values

    With this little bit of syntax help, I think the problem is solved.

    Thank you!

    Brad

  5. #5
    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,939

    Re: Changing color based on set of predetermined values

    Happy to help

    Please check to make sure that this does solve your question, and if it does, please mark this thread as SOLVED (see point 2 below)

  6. #6
    Registered User
    Join Date
    10-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Changing color based on set of predetermined values

    Or not. Oops.

    I would expect this code to shade the cell A2 this hue of blue. Instead, it shades A1. Why? results.jpg

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Changing color based on set of predetermined values

    thats because if you look at a1 it will have =$a1>2000 as its format and text is always bigger than a number
    delete the formatting in a1
    anyway isn't it supposed to be referring to result in d2?
    format in a2 should be
    =$d2>2000
    Last edited by martindwilson; 10-05-2013 at 05:28 PM.

  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,939

    Re: Changing color based on set of predetermined values

    Martin, thanks for adding the $, I overlooked the last part of the question

  9. #9
    Registered User
    Join Date
    10-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Changing color based on set of predetermined values

    Decidedly solved. Thanks everyone!

    Brad

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Extract values based on a predetermined list into a different sheet
    By fahnskap in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2013, 05:27 AM
  2. [SOLVED] changing cell values of a column based on its background color
    By liderplaza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2012, 11:08 AM
  3. Changing bar color and height based on values
    By mcp3 in forum Excel General
    Replies: 0
    Last Post: 04-05-2012, 04:22 PM
  4. changing cell color based on changing values
    By tvonbehren in forum Excel General
    Replies: 2
    Last Post: 09-16-2009, 12:33 PM
  5. macro: changing color of coloumn header based on rows color
    By rajaid in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2009, 06:43 PM

Tags for this Thread

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