+ Reply to Thread
Results 1 to 8 of 8

COUNTIF formula to look up text values and the colour of the cell

  1. #1
    Forum Contributor
    Join Date
    11-02-2003
    Location
    Birmingham, UK
    MS-Off Ver
    Office 365
    Posts
    127

    COUNTIF formula to look up text values and the colour of the cell

    Is there a way I can use a formula like COUNTIF to scan a large spreadsheet to return the number of occurrences of a value say 'XY' where the cell colour is also highlighted in Yellow ? At the same time, ignoring all the occurences where the cell isn't highlighted ?

    Any help would be gratefully received.

    Tdub
    Terry

    "... I thought I was a power user of Excel until I came onto these boards..."

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,227

    Re: COUNTIF formula to look up text values and the colour of the cell

    Hi twaccess,

    Counting values in cells is easy but the color something is, is very hard. If you had the formula that colors these cells yellow and add that criteria to a CountIfS function you might succeed.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    191

    Re: COUNTIF formula to look up text values and the colour of the cell

    You would have to create a custom fiction with vba to count cells by colour. It works by comparing them to the colour of another cell, so you would need to have an input cell where you set the background colour to the one you want to find. Google 'Excel count cells by colour'.

  4. #4
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: COUNTIF formula to look up text values and the colour of the cell

    Hi,

    Little painful, but non-vba solution is...

    Suppose your data in column B, add a helper column (e.g. column C) with any value (say 1) to your highlighted cell.
    Now use:
    =COUNTIFS(B3:B10,"XY",C3:C10,1)
    adjust the range to suite.

    Blessing.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,266

    Re: COUNTIF formula to look up text values and the colour of the cell

    Quote Originally Posted by MarvinP View Post
    Hi twaccess,

    Counting values in cells is easy but the color something is, is very hard. If you had the formula that colors these cells yellow and add that criteria to a CountIfS function you might succeed.
    It's not hard at all if the colour was applied using conditional formatting, as in such cases, the CF formula can be incorporated into the counting formula. If it has been applied manually, then it's harder.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,603

    Re: COUNTIF formula to look up text values and the colour of the cell

    Quote Originally Posted by AliGW View Post
    It's not hard at all if the colour was applied using conditional formatting, as in such cases, the CF formula can be incorporated into the counting formula.
    Isn't that what Marvin implied?

    Quote Originally Posted by MarvinP View Post
    Hi twaccess,

    If you had the formula that colors these cells yellow and add that criteria to a CountIfS function you might succeed.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,266

    Re: COUNTIF formula to look up text values and the colour of the cell

    Quote Originally Posted by Pepe Le Mokko View Post
    Isn't that what Marvin implied?
    Implied, yes, but didn't actually say. I was providing clarity in case the OP was unable to infer what Marvin was implying.

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: COUNTIF formula to look up text values and the colour of the cell

    module1:
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    I don't see in original post: VBA is prohibited

+ 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. Formula to check colour of text or colour of background
    By Wonderful World in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-07-2014, 01:49 AM
  2. [SOLVED] Macro to change text colour of adjacent cell to the same text colour as target cell
    By kayoke in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-28-2012, 04:18 AM
  3. Replies: 3
    Last Post: 12-05-2011, 09:07 AM
  4. Replies: 2
    Last Post: 06-07-2011, 07:00 AM
  5. Coloured Text In Cells Formula So Excel Knows What Colour Is Used & Uses Correct Cell
    By mightymax76 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2010, 09:24 AM
  6. Count cell values based on text colour
    By mundo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2008, 09:25 AM
  7. Getting range of cells with specific text colour, then using in a COUNTIF formulae
    By cheekyflash in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2006, 08:58 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