+ Reply to Thread
Results 1 to 15 of 15

How to add sum of cells that do NOT have colour?

  1. #1
    Registered User
    Join Date
    10-18-2008
    Location
    St John's, Newfoundland, Canada
    MS-Off Ver
    365
    Posts
    90

    How to add sum of cells that do NOT have colour?

    I have seen posts about how to add the sum of cells with specific colours, but I am looking to do the opposite...I want to ignore those cells!

    I have two columns, both with numbers in them (incoming and outgoing figures) and at the bottom I have the following simple sum in cell H103:
    =SUM(F:F)-SUM(G:G)
    This gives me my total. But what I want to do is have it so that if any of the cells in columns F or G are coloured then these numbers are ignored? Basically, I only what the cells with "No Fill" to be calculated.

    What would be the easiest way to do this?

    Thanks in advance
    Glenn
    Attached Files Attached Files
    Last edited by gloriousglenn; 02-20-2021 at 10:30 AM. Reason: Add Sample Spreadsheet

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: How to add sum of cells that do NOT have colour?

    You can't, I'm afraid. Excel formulae cannot use cell formatting to determine anything. Is there an adjacent column or row that has a marker that we could use? Is the fill applied via CF? If so, what's the rule?

    Attach a sample workbook.

    Are you still using Excel 2007? If not, please update your profile.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: How to add sum of cells that do NOT have colour?

    A function cannot detect formatting, as that is not "data". If the colours have been applied by conditional formatting, then it might be possible to apply the CF rules within a SUMIFS or SUMPRODUCT-based formula, but if they have been applied manually then you would need to use VBA to detect the colouring.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    10-18-2008
    Location
    St John's, Newfoundland, Canada
    MS-Off Ver
    365
    Posts
    90

    Re: How to add sum of cells that do NOT have colour?

    I have added a sample spreadsheet to my original post, if this helps any!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: How to add sum of cells that do NOT have colour?

    It helps, but only to confirm that there's nothing you can do with formulae alone - you will need VBA. Shall I move the thread for you?

  6. #6
    Registered User
    Join Date
    10-18-2008
    Location
    St John's, Newfoundland, Canada
    MS-Off Ver
    365
    Posts
    90

    Re: How to add sum of cells that do NOT have colour?

    Yes please...That would be very much appreciated.
    Last edited by AliGW; 02-20-2021 at 10:35 AM. Reason: PLEASE don't quote unnecessarily!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: How to add sum of cells that do NOT have colour?

    Is your profile up-to-date? It says you are using Excel 2007 ...

    I have moved the thread.

  8. #8
    Registered User
    Join Date
    10-18-2008
    Location
    St John's, Newfoundland, Canada
    MS-Off Ver
    365
    Posts
    90

    Re: How to add sum of cells that do NOT have colour?

    Profile updated

  9. #9
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: How to add sum of cells that do NOT have colour?

    Hi, You can give this a try

    The downside is the recalculation is not triggerd by just changing the color of a cell

    add the code to a module and use it like you would use the SUM() Function only this one wont count the colored cells

    Please Login or Register  to view this content.
    Please be as complete as possible in your asking so it may save use all the time to rework the solution because you didn't give all the requirements. If you have a layout in mind please work it out first so we can adapt our solution to it. Thanks.
    If you have been helped, maybe you could click the *

  10. #10
    Registered User
    Join Date
    10-18-2008
    Location
    St John's, Newfoundland, Canada
    MS-Off Ver
    365
    Posts
    90

    Re: How to add sum of cells that do NOT have colour?

    Thanks for replying Joske920
    I added the code to a module and then used the function =C_Sum(F:F)-C_Sum(G:G) but it just returns a #VALUE! result

  11. #11
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: How to add sum of cells that do NOT have colour?

    Hi,

    try this
    Please Login or Register  to view this content.
    i woudnt use full columns because it wil make it verry slow, limit your ranges this thing aint fast

  12. #12
    Registered User
    Join Date
    10-18-2008
    Location
    St John's, Newfoundland, Canada
    MS-Off Ver
    365
    Posts
    90

    Re: How to add sum of cells that do NOT have colour?

    Awesome! That worked perfectly, especially when I limited the cells, like you said, rather than using the full columns. Thank you very much.

  13. #13
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,522

    Re: How to add sum of cells that do NOT have colour?

    As per your attached example
    This in a regular module
    Please Login or Register  to view this content.
    In Cell F103 following
    =COLORFUNCTION($C$103,F2:F101,TRUE)

    Note: $C$103 has no fill
    If you change the $C$103 to $C$6 you'll get the totals for the grey colored cells.

  14. #14
    Registered User
    Join Date
    10-18-2008
    Location
    St John's, Newfoundland, Canada
    MS-Off Ver
    365
    Posts
    90

    Re: How to add sum of cells that do NOT have colour?

    Thanks jolivanes.

    I can see there the added functionality of being about to also total different cell colours if needed.

  15. #15
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,522

    Re: How to add sum of cells that do NOT have colour?

    You're welcome and thanks for letting us know.

+ 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. Colour a cell based on the colour of a range of other cells
    By Kendhal in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-04-2019, 06:19 AM
  2. Colour cells based on colour of another cell
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-12-2019, 12:54 PM
  3. [SOLVED] Search cells based on student name, cell background colour and return a tally for colour
    By drof_06 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-26-2016, 04:31 AM
  4. Replies: 3
    Last Post: 02-13-2014, 06:31 AM
  5. Change colour of cells based on another cell's colour (Not value)
    By LTrain89 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-25-2013, 08:44 PM
  6. Macro that clears contents of all cells of certain colour (colour 35) in all sheets
    By Hanskubansku in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-25-2012, 07:33 AM
  7. Changing a cell's colour basing on other cells' colour
    By rhua5436 in forum Excel General
    Replies: 11
    Last Post: 09-23-2010, 05:49 AM

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