+ Reply to Thread
Results 1 to 7 of 7

Count coloured cells - But treat cells with colour and value as 0.5

  1. #1
    Registered User
    Join Date
    10-19-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Count coloured cells - But treat cells with colour and value as 0.5

    Hi guys,

    I have a spreadsheet and a module that allows me to count coloured cells.

    If the cell with a colour in has ANY text in it, then I need it to count it as 0.5 instead of 1.

    Any ideas?

    Current Code:

    Please Login or Register  to view this content.
    Cheers

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count coloured cells - But treat cells with colour and value as 0.5

    Using your existing function change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    If you range contains formulae nulls and you wish for them to be excluded then

    Please Login or Register  to view this content.
    Last edited by DonkeyOte; 10-19-2009 at 11:36 AM. Reason: added point re: null

  3. #3
    Registered User
    Join Date
    10-19-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Count coloured cells - But treat cells with colour and value as 0.5

    If it has a value (text value) can I make it count is as 0.5 instead of 1?

    Thanks for the help so far

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count coloured cells - But treat cells with colour and value as 0.5

    Let's just clarify what you want to do exactly.

    For counting cells of a given colour, non-blanks are worth 0.5 and blanks 0 ?

    For summing cells of a given colour, non-numerics worth 0

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count coloured cells - But treat cells with colour and value as 0.5

    I'm heading off line, assuming prior post is correct then below is the original condensed and altered.

    Please Login or Register  to view this content.
    Though FWIW IMO it is ill advised to differentiate / calculate based on "feel / appearance".

  6. #6
    Registered User
    Join Date
    10-19-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Count coloured cells - But treat cells with colour and value as 0.5

    Quote Originally Posted by DonkeyOte View Post
    Let's just clarify what you want to do exactly.

    For counting cells of a given colour, non-blanks are worth 0.5 and blanks 0 ?

    For summing cells of a given colour, non-numerics worth 0
    Non blanks are worth 0.5 and blanks are worth 1.

    I am trying to count a spreadsheet that has been in use for several years - usings colours to display holiday days - And text within that colour to stipulate half a holiday day.

    Many thanks for your help so far

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Count coloured cells - But treat cells with colour and value as 0.5

    Non blanks are worth 0.5 and blanks are worth 1
    Change the 0 in the IIF to 1.

    usings colours to display holiday days - And text within that colour to stipulate half a holiday day
    Would be better to use H (or 1) in cell to denote Holiday and HH (or 0.5) for Half Holiday - use Conditional Formatting to apply colour based on the cell value if required. No VBA required from that point forth.
    Last edited by DonkeyOte; 10-19-2009 at 12:28 PM.

+ 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