+ Reply to Thread
Results 1 to 14 of 14

Formula based on the colour of the cell (counting)

Hybrid View

  1. #1
    Registered User
    Join Date
    11-02-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    30

    Formula based on the colour of the cell (counting)

    Hi

    I have a spreadsheet tracking different documents sent to me. The way I want to track it that when the doc comes in, I will mark the date as green. Is it possible to set up a formula that would count how many cells have got a fill?

    Thanks

    Renix
    Attached Files Attached Files

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula based on the colour of the cell (counting)

    Something like this?

    http://www.extendoffice.com/document...-by-color.html
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    11-02-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Formula based on the colour of the cell (counting)

    Hi Fotis,
    Thanks for your reply, I can't find the 'module' to paste the code. I am using 2007. Would that be any different?

    Thanks

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula based on the colour of the cell (counting)

    Hi

    I did my suggestion without to open your example sheet.

    Opening it is believe that a simple countif will do the job.

    Formula: copy to clipboard
    =COUNTIF(H3:H40,"First cut received")


    Also i used A cONDITIONAL fORMATTING in column H do don't need to fill with color manually.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-02-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Formula based on the colour of the cell (counting)

    Thanks Fotis, that is great.
    I will also be changing colours in Columns E, F, G to green and red. I would want to count how many greens I have.
    How would I do that?

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula based on the colour of the cell (counting)

    Quote Originally Posted by renix View Post
    Thanks Fotis, that is great.
    I will also be changing colours in Columns E, F, G to green and red. I would want to count how many greens I have.
    How would I do that?
    Count according the condittion that you'll have for been green. Which will be this?

  7. #7
    Registered User
    Join Date
    11-02-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Formula based on the colour of the cell (counting)

    Please see attached, I would like to count the number of red and green cells and then the percentage is going to be (green+red)/ number of docs.
    Attached Files Attached Files

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula based on the colour of the cell (counting)

    Ok. I ask you again. Is there a condition on which you fill with color these columns?

  9. #9
    Registered User
    Join Date
    11-02-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Formula based on the colour of the cell (counting)

    Sorry, I missed that. No, this will be manual - colour changed when the document physically received - greed if on time, red if late (but manual).

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula based on the colour of the cell (counting)

    In this case we go back to my suggestion in post#2

    Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
    Dim rCell As Range
    Dim lCol As Long
    Dim vResult
    lCol = rColor.Interior.ColorIndex
    If SUM = True Then
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = lCol Then
    vResult = WorksheetFunction.SUM(rCell, vResult)
    End If
    Next rCell
    Else
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = lCol Then
    vResult = 1 + vResult
    End If
    Next rCell
    End If
    ColorFunction = vResult
    End Function
    =colorfunction($H42;E$3:E$40;FALSE)

    This is a UDF function.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-02-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Formula based on the colour of the cell (counting)

    Spot on, one last thing - when the number of green/ red cells changes, the numbers don't update. How do I refresh the formula?

  12. #12
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula based on the colour of the cell (counting)

    Click on the result cell. Take your cursor in formula bar. Press Enter. Done.

  13. #13
    Registered User
    Join Date
    11-02-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Formula based on the colour of the cell (counting)

    Thank you for all your help!

  14. #14
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Formula based on the colour of the cell (counting)

    You are welcome and thanks for the feed back.

    As that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED,as per Forum Rule #9. Thank you.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. Replies: 1
    Last Post: 09-10-2013, 10:28 PM
  2. Colour Based Counting Formula
    By MYEM1983 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-03-2013, 10:29 PM
  3. Colour Based Counting Formula
    By MYEM1983 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2013, 06:02 PM
  4. Colour Based Counting Formula Help is required
    By MYEM1983 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-03-2013, 06:00 PM
  5. problem counting based on cell colour
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2012, 10:56 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