+ Reply to Thread
Results 1 to 9 of 9

Count certain colored cells over 4 wide

  1. #1
    Forum Contributor
    Join Date
    11-14-2004
    Location
    Watford, England
    MS-Off Ver
    Microsoft Office 365
    Posts
    131

    Count certain colored cells over 4 wide

    Hi there,

    I am working on a timeline sheet and have been stumped on doing something automatically if it can be.

    In the attached workbook I have a line of data. In it you will see certain things in different colors. What I would like to excel to do is look at all the grey merged cells and any merged cell that is over 4 blocks wide report back how many extra cells wide it is. For example in U3 there is a grey merged block that is 8 blocks wide so this should count as 4 extra and in cell AE3 that merged block is 2 extra wide. I would like the function to work across a range that I define but for testing purposes D2 to DX20 would be fine and the total number of blocks over should be in U1.

    If you require any further info please ask.

    Thanks
    Ian
    Attached Files Attached Files
    Last edited by fastcar; 08-01-2016 at 01:25 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Count certain colored cells over 4 wide

    The code runs through the list specified, counts the number of cells in the merge and writes the findings on sheet 2.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor
    Join Date
    11-14-2004
    Location
    Watford, England
    MS-Off Ver
    Microsoft Office 365
    Posts
    131

    Re: Count certain colored cells over 4 wide

    Hi There,

    Thanks for the quick reply, while this does count the merged cells over 4 I only want the merged grey cells counted. I have added some more information to the worksheet to try and show what I meant.

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Count certain colored cells over 4 wide

    Change this part of the code. It checks for a cell with the color index = 48 which is the shade of gray in the example.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-14-2004
    Location
    Watford, England
    MS-Off Ver
    Microsoft Office 365
    Posts
    131

    Re: Count certain colored cells over 4 wide

    Thank you very much. I will let you know how this goes

  6. #6
    Forum Contributor
    Join Date
    11-14-2004
    Location
    Watford, England
    MS-Off Ver
    Microsoft Office 365
    Posts
    131

    Re: Count certain colored cells over 4 wide

    Hi There,

    I have tried the code change you supplied and while it now seems to only count the grey squares the number it produces is not correct.

    For row 3 the total should be 11 as in the example I have attached 4 extra squares U3 TO AB3 (Y3+Z3+AA3+AB3) 2 extra squares AE3 TO AJ3 (AI3+AJ3) and so on giving a result of 11 for that row, but if you look in sheet 2 the result is a lot more.

    Thanks
    Attached Files Attached Files
    Last edited by fastcar; 08-01-2016 at 11:33 AM. Reason: more info

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Count certain colored cells over 4 wide

    I see what is happening, I'm counting every cell in the merged cell. So instead of just U3, I'm also detecting V3:AB3. I'll figure that out.

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Count certain colored cells over 4 wide

    I come up with 10 instead of 11. You are telling me to count cell DB3, but this is only the third cell in the merged CZ3:DB3. The two cells before it are also shaded gray, but are a separate merge. Now if you want me to count consecutively shaded gray cells, that's another story.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    11-14-2004
    Location
    Watford, England
    MS-Off Ver
    Microsoft Office 365
    Posts
    131

    Re: Count certain colored cells over 4 wide

    Hi There,

    You are correct it should have been 10 instead of 11 that is absolutely perfect thank you so much for your time in solving this issue.

    Cheers

+ 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. UDF to count colored cells always gives zero
    By capson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-04-2015, 02:01 PM
  2. how to count colored cells?
    By cat3appr in forum Excel General
    Replies: 7
    Last Post: 10-07-2015, 06:17 PM
  3. Replies: 1
    Last Post: 11-09-2013, 02:43 AM
  4. COUNT (or SUM?) colored cells
    By beanpoddy in forum Excel General
    Replies: 2
    Last Post: 03-27-2012, 01:14 PM
  5. Excel 2007 : Count colored cells in vba
    By nlm in forum Excel General
    Replies: 4
    Last Post: 08-25-2011, 07:58 AM
  6. Don't Count Cells Colored Red
    By scotfitz in forum Excel General
    Replies: 1
    Last Post: 04-20-2008, 04:19 PM
  7. Count colored cells?
    By mlk in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-30-2007, 06:30 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