+ Reply to Thread
Results 1 to 8 of 8

How to subtotal based on cell color?

  1. #1
    Forum Contributor
    Join Date
    05-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    184

    How to subtotal based on cell color?

    ExcelForumExample.xlsx

    Is it possible to subtotal based on color? Attached is an example excel spreadsheet.
    The "Example" tab is a sample data, and the "Finish" tab is how I would like it to be.
    I appreciate the help, thanks.

  2. #2
    Forum Contributor
    Join Date
    07-29-2014
    Location
    Oz
    MS-Off Ver
    2010
    Posts
    142

    Re: How to subtotal based on cell color?

    Are you using Conditional Formatting? What are your criteria for the coloring of your data? If you are using conditional formatting, you can apply the same criteria to a SUMIF to achieve this (it won't be exactly like a SUBTOTAL layout, but will be close).

    No formula can check the formatting of cells.
    Don't forget to ☆ me if I helped you!

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,714

    Re: How to subtotal based on cell color?

    Look at this video and use the concepts explained herein:

    http://www.datapigtechnologies.com/f...rtonColor.html
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: How to subtotal based on cell color?

    alexduy,

    Thanks for the workbook.

    Detach/open workbook SubtotalByColor - alexduy - EF1033224 - SDG15.xlsm and run the SubtotalByColor macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  5. #5
    Forum Contributor
    Join Date
    05-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    184

    Re: How to subtotal based on cell color?

    You guys are awsome. All methods provided works, especially thanks to Stanley for the awsome code.

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: How to subtotal based on cell color?

    alexduy,

    Thanks for the feedback.

    You are very welcome. Glad I could help.

    And, come back anytime.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,714

    Re: How to subtotal based on cell color?

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  8. #8
    Forum Contributor
    Join Date
    04-07-2009
    Location
    Rowley
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: How to subtotal based on cell color?

    If you need something that is not a Macro, you can try this.

    It is kind of a cheat, as it uses the old xl 4 macro function Get.cell which can not be called directly from a formula, but can be used with a Defined Name.

    I don't remember the exact sequence for 2003, but I believe it should be something like:

    On the Task Bar:
    1) Go to Insert
    2) select Name
    3) select Define.
    4) In the Name box, enter a name: Get_Cell_Color_L
    5) In the Refers to box, enter the following:

    =GET.CELL(63,OFFSET(INDIRECT("RC",FALSE),0,-1))

    6) Click OK
    7) Click Close

    Now, to get the color of the cell to the LEFT, (Hence the Get_Cell_Color_L) simply enter:

    =Get_Cell_Color_L


    If you need to get the cell color in any of the other directions then:

    Right: =Get_Cell_Color_R

    =GET.CELL(63,OFFSET(INDIRECT("RC",FALSE),0,1))

    Up: =Get_Cell_Color_U

    =GET.CELL(63,OFFSET(INDIRECT("RC",FALSE),-1,0))

    Down: =Get_Cell_Color_D

    =GET.CELL(63,OFFSET(INDIRECT("RC",FALSE),1,0))


    For a more info see this thread:

    http://www.mrexcel.com/forum/excel-q...arguments.html

    Just one Caveat - This will not work if the cell was colored with Conditional Formatting
    there may be a way, but I have not played with it enough to find out.
    Last edited by xenixman; 08-27-2014 at 11:39 PM.

+ 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. VBA - Subtotal based on cell color
    By The Fly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2014, 11:42 AM
  2. Macro to change cell text color based on darkness of cell fill color
    By cincyshirm61 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2014, 12:11 PM
  3. [SOLVED] Color-format a cell which contains data in a column based on the color of another cell
    By Nit3hawK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2013, 05:25 PM
  4. Replies: 5
    Last Post: 05-10-2012, 10:49 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