+ Reply to Thread
Results 1 to 11 of 11

Find the sum of all colored cells

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    Jupiter
    MS-Off Ver
    Excel 2013
    Posts
    78

    Find the sum of all colored cells

    Hello. I was wondering if there was a way to sum up all the cells in a row that are the same color. The cell's colors are based on conditional formatting.

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

    Re: Find the sum of all colored cells

    You would need to use the formula which creates the CF as the basis of the sum formula (probably using SUMPRODUCT). What is the condition that you use for the CF?

    Pete

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Find the sum of all colored cells

    Hi Skip and welcome to the forum

    1 thing you need to keep in mind regarding colors - they are just a cosmetic appled to a cell, they have no value, and have nothing to do with cell contents. As such, you cannot (directly) use any regular formula or function based ontheir color.

    If the color was applied through Conditional Formatting, then you can probably use the basis for the CF to create a sum()
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    01-14-2013
    Location
    Jupiter
    MS-Off Ver
    Excel 2013
    Posts
    78

    Re: Find the sum of all colored cells

    I used 2 conditions.

    1st. =$A$2=1
    2nd. =$A$2=2

    If $A$2=1 the entire column is highlighted blue.
    If $A$2=2 the entire column is highlighted yellow.

    I want to find the sum of all the blue cells in each row.
    I want to do the same with the yellow cells.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Find the sum of all colored cells

    without seeing a sample workbook, i can only offer a guess. try something like...
    =sumif(range-with-1,1,range-to-sum)

    If that doesnt work, i would suggest you upload a sample work book, (all sensitive data removed), showing what data you are working with, a few examples of what your expected outcome is, and how you arrived at that
    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  6. #6
    Registered User
    Join Date
    01-14-2013
    Location
    Jupiter
    MS-Off Ver
    Excel 2013
    Posts
    78

    Re: Find the sum of all colored cells

    Skip example.xlsx

    Here is an example of what I'm working with.

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Find the sum of all colored cells

    something like??

    =IF(A1=2,SUM(A2:A10)+IF(C1=2,SUM(C2:C10)))
    Last edited by vlady; 01-14-2013 at 11:11 PM.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  8. #8
    Registered User
    Join Date
    01-14-2013
    Location
    Jupiter
    MS-Off Ver
    Excel 2013
    Posts
    78

    Re: Find the sum of all colored cells

    I want to find the totals for each row.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Find the sum of all colored cells

    Try...

    F2 copied to the right and down >> =SUMIF($A$1:$D$1,COLUMN(A1),$A2:$D2)
    HTH
    Regards, Jeff

  10. #10
    Registered User
    Join Date
    01-14-2013
    Location
    Jupiter
    MS-Off Ver
    Excel 2013
    Posts
    78

    Re: Find the sum of all colored cells

    Jeff,

    That formula works perfect, thanks!

  11. #11
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Find the sum of all colored cells

    You are very welcome and 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)

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