+ Reply to Thread
Results 1 to 4 of 4

painting cells that match criteria

  1. #1
    Registered User
    Join Date
    07-24-2013
    Location
    london
    MS-Off Ver
    Excel 2013
    Posts
    21

    painting cells that match criteria

    Hi all,

    i have an input like this:
    task due date 1 due date 2 due date 3 due date 4
    A 3 5 7 13
    B 4 8 13 15
    C 2 4 12 13

    for each row i need to paint cells in different colors according to the numbers bellow.
    example, for first row:
    cells 1-3:blue,4-5:red,6-7:yellow,8-13:green.

    what is the best way to implement it?
    see attachment for clarification.

    Thanks in advance.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: painting cells that match criteria

    hi oleg

    i'm surprised nobody gave you any suggestions to this problem

    there are many approaches you could take, the most common would be a vba script to scan through the values and assign formats as appropriate

    I've supplied you with an alternative approach

    In the attached file I made a copy of your example table, then applied some logic to it so it can identify which dates fall within each of your due dates

    To distinguish each due dates I just used the column number as a quick way of identifying each into a group, you could choose another output

    I then, for illustrative purposes made a copy of that table which had the formula applied to show how you can use conditional formatting to give the desired output as you'd illustrated in your example image file and excel file, just set the fill color and font color to be the same, different colors for each value used (3,4,5,6)

    Using this method does away with any vba coding

    (btw - it showed that you made a mistake in your example file for task C, you excluded due date 4)

    maybe this method is something you can work with, if you need help in applying it to your actual data let me know and i'll do my best to assist

    32
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-24-2013
    Location
    london
    MS-Off Ver
    Excel 2013
    Posts
    21

    Re: painting cells that match criteria

    wow thanks!
    it's really great what you've done, and without VB.
    i'll adjust it to my needs, but this is a great reference!
    thanks again!

  4. #4
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: painting cells that match criteria

    PHP Code: 
    Option Explicit
    Sub gpePaitingCells
    ()
     
    Dim J As ByteAs LongMyColor As ByteMyNum As Long
     
    For 4 To 6
        
    For 6 To 3 Step -1
            MyNum 
    Cells(JW).Value
            MyColor 
    34 MyNum
            Cells
    (J7).Resize(, MyNum).Interior.ColorIndex MyColor
        Next W
     Next J
    End Sub 

+ 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. Painting cells whose sum is zero
    By zizao in forum Excel General
    Replies: 4
    Last Post: 03-06-2014, 01:10 PM
  2. Replies: 5
    Last Post: 09-22-2009, 06:11 PM
  3. Painting Cells Formula
    By AFIOF719 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-17-2008, 02:10 PM
  4. Painting Locked Cells
    By Shrikant in forum Excel General
    Replies: 3
    Last Post: 08-20-2006, 01:10 PM
  5. comparing and painting cells
    By redf1re in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2006, 03:32 PM

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