+ Reply to Thread
Results 1 to 13 of 13

Counting color cells that has value of less or equal to 2

  1. #1
    Registered User
    Join Date
    01-11-2014
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    41

    Counting color cells that has value of less or equal to 2

    Hi, i have a table that looks like this in the attached file. The example only shows 4 columns by in my real working file, there's 36 columns.

    Basically, i need help to count the number of colored cells (any colors) that has value of less or equal to 2 by columns. Is there any way to do it?

    I found some solutions on internet by counting colored cells based on color index. But that is not what i need. I do not care about color index. As long as i can count any colored cells within same column that is <=2.

    Thank you.


    Capture.JPG

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Counting color cells that has value of less or equal to 2

    How are the cells actually colored?
    Are they conditional formatting? If so, you can base your count on those conditions.

    Are they standard manual formatting? That will be difficult, to say the least.
    Is there any pattern or reason to indicate why the cells are colored ?
    Or a reason others are NOT colored ?

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Counting color cells that has value of less or equal to 2

    Removed by JT:
    Last edited by JohnTopley; 08-11-2016 at 10:19 AM.

  4. #4
    Registered User
    Join Date
    01-11-2014
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Counting color cells that has value of less or equal to 2

    Hi Janmo1

    The cells are colored manually based on product type. Product 1 = LIght blue, Product 2= dark blue etc

    Hi JohnTopley
    =COUNTIF(B:B,"<=2") only counts rows that is less or equal to 2 without consideration of colored cells. But i need to only count colored cells that is less or = to 2

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Counting color cells that has value of less or equal to 2

    So there isn't any (formula-based) selection criteria to identify whether a cell is coloured?

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Counting color cells that has value of less or equal to 2

    Hi Janmo1

    The cells are colored manually based on product type. Product 1 = LIght blue, Product 2= dark blue etc
    Great, so you should be able to do
    =COUNTISF(A1:A100,"<=2",B1:B100,"Product1")

    For multiple products, do
    =SUM(COUNTIFS(A1:A100,"<=2",B1:B100,{"Product1","Product2","Product3"}))

  7. #7
    Registered User
    Join Date
    01-11-2014
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Counting color cells that has value of less or equal to 2

    thanks. But both formula returns #Value error

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Counting color cells that has value of less or equal to 2

    Post a sample file.

    To upload file clicj "Go Advanced" then scroll down to "Manage Attachments"

  9. #9
    Registered User
    Join Date
    01-11-2014
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Counting color cells that has value of less or equal to 2

    Hi,

    Attached is the sample file.

    Every week, when supplier sent over the SKU stock count list. I'll update in the inventory qty column by SKU and by Store and manually colored the rows.

    Then i need to count the number of colored cells that is less than or equal to 2.

    Thanks
    Rac
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Counting color cells that has value of less or equal to 2

    You can do that using a helper column with the help of Get.Cell

    See the attachment. Press Ctrl+F3 to see the formula of named range color.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    01-11-2014
    Location
    singapore
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: Counting color cells that has value of less or equal to 2

    Thank you so much. It works perfectly! (even though right now i have 35 columns and will need to create another set of 35 columns more to pickup the color index).

  12. #12
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Counting color cells that has value of less or equal to 2

    Quote Originally Posted by yankiessg View Post
    Thank you so much. It works perfectly! (even though right now i have 35 columns and will need to create another set of 35 columns more to pickup the color index).
    I wish if anyone else can give you any other solution to this, so that you don't need to create more columns.

  13. #13
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Counting color cells that has value of less or equal to 2

    Here's a VBA solution.

    Put this in a standard module
    Please Login or Register  to view this content.
    You can use it like this to get a true or false result if the cell has a fill color
    =HasColor(A1)

    It has an optional 2nd argument to make it check for a specific color.
    =HasColor(A1,B1)
    Where B1 would be another cell that is the specific color you want to test for.

    Then to use it to make a count, with criteria <=2
    =SUMPRODUCT(--HasColor(B3:B27),--(B3:B27<=2))
    Attached Files Attached Files

+ 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: 5
    Last Post: 06-25-2015, 12:05 PM
  2. [SOLVED] Change the color of cells if the sum of those cells is equal to 12.
    By dvd66har in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-31-2015, 03:49 AM
  3. [SOLVED] Conditional Formatting Formula - Chang color of cells is other cell is equal to..
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 09-29-2013, 11:00 PM
  4. Counting cells with color
    By Statz in forum Excel General
    Replies: 3
    Last Post: 05-10-2013, 12:27 AM
  5. Counting adjacent cells(text) to equal one value
    By Calithea in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-29-2012, 04:08 AM
  6. [SOLVED] Counting cells in a column to add formulas to that equal number of cells
    By flipjarg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 11:45 AM
  7. Counting congruent cells and noncongruent cells with the same background color.
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2009, 05:52 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