Consulting

Results 1 to 15 of 15

Thread: Solved: Select case for conditional formatting to build heat chart?

  1. #1
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location

    Solved: Select case for conditional formatting to build heat chart?

    Good day everybody. I hope everybody day is going well.

    I’m using Excel 2003

    I’m in the process of building a 5 color “Heat Map” of certain issues failing in a product. I’ve researched it, goggled it, and could find what I need, so I’m posting here to have ideas.
    What I got is a set of dates with the number of times the product predefine issues fail, and what I want is to color code these cells totals to the number indicated in the legend. I got 5 color codes for the failing mode and 24 issues so breaking down the colors in the failing issues I want to group them ;
    1st color (blue) 1 cell to be No.1 fail and be 4% of the failing Issues.
    2nd color (red) 3 cells to be No. 2 fail and be 13% of the failing Issues.
    3rd color (gold) 5 cells to be No. 3 fail and be 21% of the failing Issues.
    4th color (light yellow) 15 cells to be No. 4 fail and be 63% of the failing Issues.
    The column where the daily total scores are has at the end a total that can be use to do the percentages of Issues and possibly the key to color conditionally format the cell shading.
    On the Sheet 2 in the attached workbook has a drawing of the intended number of color that need to be use in the Heat Map .
    I was going to start using conditional formatting, but I found that it can not be done more than 3 times. Can this be done any other way?


    Thanks in advance for any help.

    Edit by Lucas as Jose's request: percentages part corrected.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Try this, it works for many different colors in conditional formatting.

    colors are Blue = 5
    red = 3
    gold = 44
    yellow = 6

    http://vbaexpress.com/kb/getarticle.php?kb_id=90
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    Lucas, thanks for the link, I think is what I was looking for in the formatting area. Now I’m trying to structure how to apply this color formatting to the range.
    I have another question; How can I extract the groups as I show in the sample workbook?
    I was thinking extract the max, median and min values of the range, but I don’t thing will work since I need to have the cell coloring grouped as I describe it on the workbook sample; (with in the 24 cells values)

    The highest value of all Blue 1 cell, then the next 3 cell values less than the greatest value Red, and the next 5 cells less than the last lowest value of color Red colored Gold and the rest left Light Yellow. I don’t know how to capture the dynamic less value of the previous color value to apply the color to the next down color set.


    Or there may be a simpler way to do it?

    Can somebody help?
    Last edited by IgnBan; 05-03-2008 at 03:49 PM.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Ignban, it would help if I understood a little more what your are trying to do. I am looking at the sheet ColorCodeBreakdown. Is that the sheet where we are going to try to implement the code? If so why is there only one blue and more of the other colors.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    Lucas, thanks again for replaying. I made another sample workbook I hope this explain better what I'm trying to accomplish.
    All I need is rank the cell values and color code them, but I want specific number of cells colored according to their rank.

    Thanks again!

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Let me know if I got close Ignban. You have to add an new number or change one of the existing ones to get it to fire.


    the code is in the code for the sheet, not in a standard module.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  7. #7
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    but I want specific number of cells colored according to their rank.
    I just saw this part but you should be able to tweak it to get your desired result....if not post back.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  8. #8
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    Lucas thanks for you input. The way you color coded the range is the future intent after couple of year collecting data, but right now the main thing is row 7. I conditionally formatted row 7 to mimic what I want to do.

    If you take a looks at Sheet3 in attached workbook it may explain better what I'm trying to accomplish.
    In row 7 need to color code according to legend in a breakdown/ranking like this;

    1st color (blue) 1 cell to be No.1 fail and be 4% of the failing Issues.
    2nd color (red) 3 cells to be No. 2 fail and be 13% of the failing Issues.

    3rd color (gold) 5 cells to be No. 3 fail and be 21% of the failing Issues.
    4th color (light yellow) 15 cells to be No. 4 fail and be 63% of the failing Issues.

    Row 7 is the sum values of Row 27 down.

    Thanks for you input,
    I hope Sheet3 explain better my objective.

  9. #9
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Will the data always go into row 6 or does that vary?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  10. #10
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    The data will always be in row 7, Sheet "HeatMap" is the working copy. Sheet3 is only a sample to explain the need. In Sheet "HeatMap" the row7 is the one need it to have the conditional formatting .

    PS
    The data in Sheet "Heat Map" row7 is constantly every day changing as data is appended below row 27.

  11. #11
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Jose, the decimals are playing tricks on me so I will have to tinker with this to see if I can get it to do what you desire. It would help immensly if we could get rid of the decimals...maybe round up or down in the cell formula's.....would that be a problem?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  12. #12
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    Steve, the posted workbooks were formatted to have no decimals in any cells. No, decimal shouldn't be any problem.

    Steve Thanks for your help!

  13. #13
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Hey Jose cell C6 in the heatmappostfinal from post #8 has one for example.

    ie[vba]172.289683815563[/vba]

    that's on sheet 3. you have formula's in your main sheet maybe we could round them if that is ok.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  14. #14
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Try this one Jose
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  15. #15
    VBAX Contributor
    Joined
    Jan 2008
    Posts
    104
    Location
    Thanks Lucas, I'll tweak it from here.

    Thanks for all your help.

Posting Permissions

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