+ Reply to Thread
Results 1 to 8 of 8

Sum total time based on color of cell

  1. #1
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Sum total time based on color of cell

    I have a list of times with sum being green (good) and some being red(bad). I need to total just the red ones to get the total time. I keep getting a name error and I cant figure out why?
    Attached Files Attached Files

  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,410

    Re: Sum total time based on color of cell

    There is no SUMBYCOLOUR function in Excel - you need a UDF, and there is no UDF defined in the workbook.

    I am moving this to the VBA section for you.
    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 Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Sum total time based on color of cell

    Hi Chris,

    Since you have criteria to color a cell in column M either Red or Green, use that same criteria to Sum. No need for a UDF or VBA.

    Green >> R11 =SUMIFS(M3:M19,M3:M19,">0",M3:M19,"<0.00694444444444444")
    Red >> R12 =SUM(M3:M19)-R11
    HTH
    Regards, Jeff

  4. #4
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: Sum total time based on color of cell

    I have the module populated with the UDF but it is still not working.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Sum total time based on color of cell

    That code cannot detect cells coloured by CF.
    Why not use the formulae suggested by Jeff? It's a lot easier.

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

    Re: Sum total time based on color of cell

    And it will never work because the interior color of cell R11 is not the same as the interior color of the "Red" colored cells in Column M.

    Column M is "Red" or "Green" thru conditional formatting. The color is not the same.

    For your testing, put some numbers in T7:T9. Now in T11 >> =sumbycolor(R11,T7:T9)

    Why not use the formulas I posted?

  7. #7
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: Sum total time based on color of cell

    the criteria is going to change. I thought I could do (conditional formatting based on the value of another cell) AND using color would be the easiest way. how can I make your formula point to a cell to get the criteria rather than listing the criteria in the formula and having to always change it?

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

    Re: Sum total time based on color of cell

    Try

    =SUMIFS(M3:M19,M3:M19,">"&A1,M3:M19,"<"&A2)

+ 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] Cell color changing based on Time passed
    By monaghan4523 in forum Excel General
    Replies: 23
    Last Post: 04-24-2019, 12:17 PM
  2. Change cell format (cell color+font color) based on color of another cell
    By Dedaluss in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2017, 03:27 AM
  3. Calculating total time based on start and end time.
    By famin in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 02-11-2016, 09:50 AM
  4. Sum numbers and change cell color each time a target total is reached
    By mike3029 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-18-2014, 02:08 AM
  5. how to work out rate based on total time and total amount
    By lisaathers in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-09-2013, 06:44 AM
  6. [SOLVED] Purge Data Based on Cell Color and Time
    By Todd in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-23-2005, 04:06 PM
  7. Replies: 1
    Last Post: 04-20-2005, 01:06 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