+ Reply to Thread
Results 1 to 9 of 9

Sumif cell is certain color

  1. #1
    Registered User
    Join Date
    04-09-2014
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    56

    Sumif cell is certain color

    Hi There,

    Just wondering if there is away how to sumif with criteria being the cell colour?

    Cheers

    Ryan

  2. #2
    Forum Contributor
    Join Date
    04-01-2009
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2010
    Posts
    280

    Re: Sumif cell is certain color

    Found this code for a UDF...

    Please Login or Register  to view this content.
    You can use this code by adding it to a module in your workbook and then using the formula:
    =SumByColor(sumrange,cellwithcolor)
    Just format the cellwithcolor to the color you want to sum.

  3. #3
    Registered User
    Join Date
    04-09-2014
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Sumif cell is certain color

    Is there away how to do this not involving VBA?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sumif cell is certain color

    If the color format is manually applied then this can not be done without the use of VBA.

    In general, it's not a good idea to base calculations on cell formats.

    If the color is applied using conditional formatting you should be able to build a formula based on the logic that's used to apply the CF.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    04-09-2014
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Sumif cell is certain color

    Thanks Tony,

    Yes it is based on a conditional formatting. The conditional format is as follows, if a formula is overwritten the cell changes colour. My conditional formatting formula is =G10<>IFERROR(('BU Template (LY)'!G10/SUM('BU Template (LY)'!$S$10:$S$121)*((Headsheet!$F$5-Headsheet!$F$9)/(1+Headsheet!$F$4))),0) and this conditional format is applied to the matrix G10:R121

    Do you know how I can apply this to sumif? I am struggling with the sumif 'criteria' alters depending on the cell reference, i.e. the formula above is only true for cell G10

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sumif cell is certain color

    Maybe this array formula**:

    =SUM(IF(G10:R121<>IFERROR(('BU Template (LY)'!G10/SUM('BU Template (LY)'!$S$10:$S$121)*((Headsheet!$F$5-Headsheet!$F$9)/(1+Headsheet!$F$4))),0),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  7. #7
    Registered User
    Join Date
    04-09-2014
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Sumif cell is certain color

    Thanks for the reply Tony,

    I think it is definitely on the right track, the formula I have now is

    =SUM(IF('BU Template'!G10:R121<>IFERROR(('BU Template (LY)'!G10:R121/SUM('BU Template (LY)'!$S$10:$S$121)*((Headsheet!$F$5-Headsheet!$F$9)/(1+Headsheet!$F$4))),0),1)), However this is not quite working as only counts the number of cells that have been overwritten (changed colour) How do I amend this to sum the cells that have been amended???

    Cheers for your help so far

  8. #8
    Registered User
    Join Date
    04-09-2014
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Sumif cell is certain color

    Hey Thanks for your help, Have managed to sort it

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Sumif cell is certain color

    Good deal. Thanks for the feedback!

+ 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] SUMIF based on cell font color
    By luizmachado in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-06-2016, 10:51 AM
  2. [SOLVED] Sumif by color
    By brandedadnan in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 04-15-2015, 06:32 AM
  3. Sumif on cell color
    By Bridge1969 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-08-2014, 01:27 PM
  4. [SOLVED] SUMIF (cell color)
    By snowb46 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-21-2014, 07:31 PM
  5. Replies: 4
    Last Post: 12-29-2013, 11:41 PM
  6. SUMIF color=...
    By JChandler22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-02-2007, 03:32 PM
  7. Sumif and base it on font color of cell
    By Bruce in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-28-2005, 06:05 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