+ Reply to Thread
Results 1 to 9 of 9

Making Sum of cells that have or dont have a fill color

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Antwerp
    MS-Off Ver
    Excel Mac 2011
    Posts
    5

    Making Sum of cells that have or dont have a fill color

    I don't know how to start. I googled a couple of things but they didn't work.

    Basically i need two formulas.
    1) formula that makes a sum of the selected cells that have no background fill
    2) formula that makes a sum of selected cells that do have a background fill


    Could anybody help me out please?


    Much appreciated.


    Nader
    Attached Files Attached Files
    Last edited by nadermourad; 04-25-2012 at 09:59 AM.

  2. #2
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Myrtle Beach, South Carolina
    MS-Off Ver
    =IF(Win 7,"Excel 2010","Mac Excel 2011")
    Posts
    104

    Re: Making Sum of cells that have or dont have a fill color

    Can You attach a sample worksheet?

  3. #3
    Registered User
    Join Date
    04-25-2012
    Location
    Antwerp
    MS-Off Ver
    Excel Mac 2011
    Posts
    5

    Re: Making Sum of cells that have or dont have a fill color

    I attached the file.
    So right now i manually made a sum of the cells with a color fill and sum of the cells without color fill.
    But now i need a function that does that automatically.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Making Sum of cells that have or dont have a fill color

    There is no inbuilt function, you need VBA to do this
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    04-25-2012
    Location
    Antwerp
    MS-Off Ver
    Excel Mac 2011
    Posts
    5

    Re: Making Sum of cells that have or dont have a fill color

    Can you give me the VBA code then?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Making Sum of cells that have or dont have a fill color

    here's an example
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-25-2012
    Location
    Antwerp
    MS-Off Ver
    Excel Mac 2011
    Posts
    5

    Re: Making Sum of cells that have or dont have a fill color

    Thanks a bunch for that!
    Just one question:

    What is this for :


    Sub TestCount()
    MsgBox ColourFunction(Range("a2"), Range("A2:a4"), 1)
    End Sub
    Sub testSum()
    MsgBox ColourFunction(Range("a2"), Range("A2:a4"), 2)
    End Sub

  8. #8
    Registered User
    Join Date
    04-25-2012
    Location
    Antwerp
    MS-Off Ver
    Excel Mac 2011
    Posts
    5

    Re: Making Sum of cells that have or dont have a fill color

    I'm so sorry to bother you but my Excel/VBA skills are pretty limited and i cant seem to understand the whole example

    Could you delete the rest of the example so i can simply copy n paste whatever it is i need to use?
    So i dont need the averages or count or stuff like that.
    I simply need the sum of the color filled cells within the range of :T4 - T999999

    How would my vba code look then?

  9. #9
    Registered User
    Join Date
    08-20-2012
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Making Sum of cells that have or dont have a fill color

    roy
    This is great except when there are No Cells that color. In that case I need an Count of "0". instead I get #Value.
    How can I change to code for ColourFunction2 to give teh correct count?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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