+ Reply to Thread
Results 1 to 6 of 6

CountCColor and COUNT IF

  1. #1
    Registered User
    Join Date
    09-13-2006
    Posts
    23

    CountCColor and COUNT IF

    Hi guys,

    I have inserted a module into a spreadsheet which counts the colors of cells using this formula: =CountCcolor(U8:U121,$T135) where T135 is a reference cell containing the pink color.

    I am now trying to combine this with a countif function.

    So I'd like it to return how many people have the colour pink and have either A,B1, B2 or B3 in the cell.

    =COUNTIFS(U8:U121,"B3")+COUNTIFS(U8:U121,"B2")+COUNTIFS(U8:U121,"B1")+COUNTIFS(U8:U121,"A")

    Any help appreciated as always.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: CountCColor and COUNT IF

    You cannot simply add or multiply
    These are separate/independant conditions, so you probably shall edit code of CountCcolor to allow one more argument, like
    Please Login or Register  to view this content.
    You could do this with COUNTIFS, becasus conditioons were dependent on each other.
    Cell with A is for sure not cell with B1 or B2 of anything else than A.
    Last edited by Kaper; 09-18-2018 at 04:27 AM.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    09-13-2006
    Posts
    23

    Re: CountCColor and COUNT IF

    ok could you please show me what you mean using this code

    Please Login or Register  to view this content.
    Last edited by crazymaca69; 09-18-2018 at 10:07 AM.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: CountCColor and COUNT IF

    For instance write B3, B2 etc in some range and supply it as third argument to
    Please Login or Register  to view this content.
    Please note how CODE tags improve readability and edit your post to comply with [/I]Rules of our Forum .

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

  5. #5
    Registered User
    Join Date
    09-13-2006
    Posts
    23

    Re: CountCColor and COUNT IF

    ok thanks, got that working.

    So now if i want to add a fourth argument which will be a different range?

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: CountCColor and COUNT IF

    Hi,
    My idea was that you just list somewhere in a worksheet all values

    B3
    B2
    B1
    A

    Let's say you did it in Z1:Z4 range

    so write:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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: 2
    Last Post: 03-03-2018, 05:00 AM
  2. Replies: 1
    Last Post: 05-19-2017, 07:37 AM
  3. =CountCcolor() not counting from 'fill' bucket
    By helloboots in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-19-2016, 02:10 PM
  4. Replies: 17
    Last Post: 04-11-2016, 11:14 PM
  5. CountCcolor and COUNTIF(S)
    By BarryGoddard in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-19-2015, 09:29 AM
  6. Macro count items in sheet2 and provide count in embedded label in sheet1
    By jaredmccullough in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-05-2015, 11:27 AM
  7. Range.columns.count property returns wrong count after union operation
    By gopinan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2008, 04:48 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