How To Count Colors with an Excel Function | Count Colored Cells

Поділитися
Вставка
  • Опубліковано 28 сер 2024
  • In this Excel video tutorial, I'll show you how to make an Excel function to count colors in Excel.
    If you have a table, a spreadsheet, where you colored your cells, you can count the colors with this formula that I'm going to show you.
    So, for example, in an accounts payable spreadsheet, you painted all overdue accounts yellow and now you need to know how many overdue accounts, yellow cells, you have in your table. With this color counting function in Excel, you will be able to do this math.
    To create this function in Excel, we will use Excel's Visual Basic Application or VBA.
    Function COUNT_COLOR(RANGE As Range, COLOR As Range)
    Dim COLORC As Integer
    Dim COUNTT As Integer
    COLORC = COLOR.Interior.ColorIndex
    Set IC = RANGE
    For Each IC In RANGE
    If IC.Interior.ColorIndex = COLORC Then
    COUNTT = COUNTT + 1
    End If
    Next IC
    COUNT_COLOR = COUNTT
    End Function
    #JopaExcel #Dashboard #Excel

КОМЕНТАРІ • 218

  • @meowmeow1733
    @meowmeow1733 8 місяців тому +1

    🎉🎉🎉🎉🎉🥳🥳🥳🥳🥳
    Thank you.
    After trying chat GPT👎, Google 👎, and one other video.....YOU...you are the first person/video to show me a solution that works. Thank you.
    Chapt gpt's not taking anyone's job in excel this year. Yah, it's fancy, but who cares if it consistently spits out things that don't work.

    • @Allinone-sh6cj
      @Allinone-sh6cj 8 місяців тому +1

      Just learn visual basic coding and you're good to go but its not easy you want more focus

  • @thrpersonalaccount6898
    @thrpersonalaccount6898 4 місяці тому

    Thank you so much! There isn't much out there for Macs, so I didn't even know where to start (I've never created a UDF or Macro before in Excel). You made it so straight-forward. 🙂

    • @JopaExcel
      @JopaExcel  4 місяці тому

      Thanks for the feedback. I'm glad the video helped you. 😁

  • @franciscorosario5681
    @franciscorosario5681 2 місяці тому

    a lots of year looking for this jack and you did it easy for us Bro. Thanks a lot for your time and explanation.

  • @Va113n
    @Va113n 2 місяці тому

    Brilliant, works like a charm. I found that the formulae needs to be redone every time you open a new sheet. If there is a fix, kindly share.

  • @lizgabbett9844
    @lizgabbett9844 3 місяці тому

    I'm so very grateful for this video! You have saved me hours of work. Thank you!

    • @JopaExcel
      @JopaExcel  3 місяці тому

      Glad it helped! 🙏👍

  • @user-yd1bo8ic9j
    @user-yd1bo8ic9j 9 місяців тому +6

    Hi i've use the method you show and it works🎉🎉🎉
    But 1 issue i found is after i save the file as macro-enable worksheet the formulas did not automatically update i have to double click the formular cell in order for it to recalculated

    • @user-yd1bo8ic9j
      @user-yd1bo8ic9j 9 місяців тому +1

      F9 did not work

    • @d4ve19
      @d4ve19 4 місяці тому

      @@user-yd1bo8ic9j not ideal but I've found that if you copy and paste colours already on the sheet to populate new colours, the count will update straight away.

  • @razvancarp7999
    @razvancarp7999 8 місяців тому +1

    love you bro. I was searching for it and found nothing useful until I saw your video. You are the best! ;)

  • @ruturajjadhav6137
    @ruturajjadhav6137 5 місяців тому

    Thank You, Very Good explanation. Looking Forward for other formulae,
    One thing I would like to add, it also counts the merged cells. Where as it should give a whole count for all the cells.
    I hope you would add the change and make a video

  • @robertrussi8913
    @robertrussi8913 6 місяців тому +1

    Excellent tutorial, straight to the point and easy to understand

    • @Intellectual_House
      @Intellectual_House 4 місяці тому

      it works for me but the function is not saved , like if i use another excel document I can't find it do you have the same problem

  • @edygless
    @edygless 6 місяців тому +3

    Hello!
    Thank you for your help!!! This video helps me to solve a problem. But, How can I do the function to automatically update the count?

  • @isaacgarciarojas521
    @isaacgarciarojas521 3 місяці тому +3

    Thank you for the video! I would just add a line below the function declaration that states: Application.Volatile so the values returned by the function update as the spreadsheet changes.

    • @listenSONE9
      @listenSONE9 3 місяці тому

      Hey you're right, the formulas don't update automatically! Where do we add that line exactly?

  • @rishimuni07
    @rishimuni07 4 місяці тому +1

    Thanks for this. Very clear. To the point. Helped a lot!
    I just have one additional query, what can be done extra in the sheet, so that when I colour a cell as Green, the count of Green increase by +1?

  • @mif4158
    @mif4158 20 днів тому

    Thank you! Easy and straight to the point

  • @billycen9501
    @billycen9501 4 місяці тому +1

    Do work John! This is 1x useful and easily digestible tutorial

  • @suniyem1
    @suniyem1 11 місяців тому +10

    Thanks for this valuable information... appreciated but how to make it automatically ? Each time color change then the count also change without pressing enter

    • @jasonf5659
      @jasonf5659 3 місяці тому

      I need this as well.

  • @SkiShorts777
    @SkiShorts777 5 місяців тому

    Very useful, couldn't find anyone else who explains this so clearly!

  • @theeeriepolymath539
    @theeeriepolymath539 11 місяців тому

    God no one ever explained how to activate the developer tab!! thanks i was stuck om this from 3 days...Keep posting content..You're a good teacher and explain well

    • @JopaExcel
      @JopaExcel  11 місяців тому +1

      You are right lol... I always like to teach objectively, but also showing all the small steps that are necessary to reach the final goal. Thanks for the positive feedback 🙏👍

  • @HcV82
    @HcV82 Місяць тому

    You rock buddy! Straight to the point! Thank you!

  • @robbie_t1525
    @robbie_t1525 2 місяці тому +1

    This is great.....except......it doesn't seem to continue counting automatically. What I mean is, every time I put in a new entry in the coloured field, I then have to click on the count_colour function cell to bring up the edit panel and hit enter for the count to go up by one. Any ideas why that would be happening?

  • @monciak3001
    @monciak3001 9 місяців тому +2

    Perfect! U are the best 😊 One more thing I need. How can I do autorefresh outcome after I change number of colours? 😎

  • @kristycarlson1042
    @kristycarlson1042 Рік тому +3

    You just saved me so much time - THANK YOU for this!!

    • @JopaExcel
      @JopaExcel  Рік тому

      I'm glad you liked it! Thank you 🙏👍

  • @darren20160650
    @darren20160650 4 дні тому

    I found this really helpful, thank you!

  • @irshduck
    @irshduck 5 місяців тому

    Just another UA-cam HERO! Thank you!!

    • @irshduck
      @irshduck 5 місяців тому

      Doesnt seem to pick up on formatted cell colors. Still troubleshooting

  • @richardkavanagh4751
    @richardkavanagh4751 7 місяців тому +4

    Thank you for this. How do I get it to refresh automatically. It seems at the moment if I change a cell colour the count does not change,

    • @lealeite9101
      @lealeite9101 6 місяців тому

      I have the same question...

  • @MargoBelyaeva
    @MargoBelyaeva 9 днів тому

    thank you so much! it helped me a lot

  • @makingmemories8373
    @makingmemories8373 5 місяців тому

    Thank you sooo much. You're a Savior...

  • @anabelaferro4933
    @anabelaferro4933 9 місяців тому +4

    Your tutorial has been a life saver! Thanks!

  • @liamhowlett1572
    @liamhowlett1572 3 місяці тому

    Thankyou for this, i have an issue however, i have to reapply the formula in the cell for the number to update, it doesnt update automatically. Even though I have the Calculation options set to automatic, any help?

  • @user-eq8hg5vr5s
    @user-eq8hg5vr5s 5 місяців тому

    Thank you very much for the simple explanation and valuable information.

  • @johnnybegood3124
    @johnnybegood3124 5 місяців тому

    Thank you for this information.. It worked PERFECTLY...

  • @user-kz3vw5jt6n
    @user-kz3vw5jt6n 8 місяців тому +17

    Good formula, but it has one problem, if the color changes in the range, the count doesn't change automatically. so we need to again refresh the formula

    • @lymphhh
      @lymphhh 7 місяців тому

      Is there a solution???

    • @conma3
      @conma3 6 місяців тому

      I agree with you
      It is a problem need to be solved

    • @rfassberg
      @rfassberg 6 місяців тому

      It is a limitation of how Excel processes VBA functions.

    • @BCOzSportsGamer
      @BCOzSportsGamer 3 місяці тому +1

      Found a way. You can create a macro. For me, I have 4 cells I want to update the counts for. Record Macro > name macro > ok > click in each cell that you have the count_color formula in, once at a time, and enter at each of them. Then stop macro recording, insert a button form control and assign to the macro.

    • @coatedlamb2061
      @coatedlamb2061 Місяць тому

      ​@@BCOzSportsGamer For anyone else that got confused by this, what he says is CORRECT, just make sure to click on the "=COUNT_COLOR" in the text box just underneath the ribbon

  • @sophiagarcia-p2c
    @sophiagarcia-p2c 8 днів тому

    Thank you so much, nice tutorial

  • @AA-nj2ni
    @AA-nj2ni 8 місяців тому +3

    It doesn't work for my table of conditionally formatted colored cells. So i have a large set of number which are highlighted green whenever they are equal a certain number. I wanted the formula to count the highlighted conditionally highlighted cells when they change. This only works when the cells are manually colored.. do you know how to solve this for me please.
    🙏

  • @elankoko
    @elankoko 3 місяці тому

    Thank you so much. You made it so simple and easy.😊

    • @JopaExcel
      @JopaExcel  2 місяці тому

      Glad it helped! 🙏👍

  • @chikaka3170
    @chikaka3170 2 місяці тому

    Very nice tutorial. Just wondering if it is possible to automatically refresh the count as I would like to change color let's say in one of the cells?

  • @CJT1869
    @CJT1869 10 місяців тому +2

    Thank you so much for this, so very helpful. One question, when I change a cell to the color that I'm counting, how do i get the function to automatically update? I keep having to go the the function in the bar and hit enter for it to update.

    • @JopaExcel
      @JopaExcel  10 місяців тому

      I'm very happy that the video helped you and thanks for the question.
      Try to use the shortcut key F9, maybe it will be able to update the sheet without you having to click in the cell and then click out. At least, it's faster to just hit the F9.

    • @vaikas1982
      @vaikas1982 8 місяців тому +3

      @@JopaExcel F9 not update for me :(

  • @jeanmariecovoza2573
    @jeanmariecovoza2573 5 місяців тому

    Thank you so much, so happy that i dropped your vedio.. very helpful

  • @brianhammer8968
    @brianhammer8968 16 днів тому

    Is it possible to count the color if the cells have multiple conditional formatting rules? It only works when I delete the number and then make the square the color but then I have no value in the cell.

  • @journeyoflife5740
    @journeyoflife5740 22 дні тому +1

    When there is an character on the cell, it doesn't count.
    How to get this done.?
    Please help

  • @CJFlowVibes
    @CJFlowVibes 10 місяців тому

    it's work 100%, straight to the point and yea big thanks guy

  • @AaronTrumble-l9h
    @AaronTrumble-l9h Місяць тому

    thankyou, this is wonderful. however today when opening the file I get#name error. Any ideas why? it was working perfectly

  • @qpappa318
    @qpappa318 2 місяці тому

    Great video, what if I wanted to count the number of colored cells regardless of the unique color in a column? For example, I have a column with 8 different colored cells in it and I want a formula to just show me how many cells in that column have any color.

  • @devender60
    @devender60 4 місяці тому

    Thanks for the amazing tutorial. How to save this permanently in the excel. When I am closing excel it is gone. Or everytime i have save the function.

  • @reenurenjith1529
    @reenurenjith1529 Місяць тому

    hi, thank you so much. pls update on how to write a function to count adjacent cells with same colors. if two adjacent cells(eg: C1,D1) are having same color green, need to increment count by one. if two adjacent cells are of different color green and yellow, the count doesn't increment. pls help on the same.

  • @fayaz004
    @fayaz004 8 місяців тому

    Wow amazing.. this worked and saved lot of time.

    • @JopaExcel
      @JopaExcel  8 місяців тому

      Glad it helped 🙏👍

  • @dhaffirm1
    @dhaffirm1 Місяць тому

    So helpful, thank you!

  • @AshokKumar-hd7pz
    @AshokKumar-hd7pz 4 місяці тому

    Hello Jopa I am great fan of yours and learned lot of excel formulas by seeing your vedios now i need a help hope you would help me in our office we have a daily tracker in that we have 12 agents and works in 24/7 shifts we work on incident tickets as soon as the ticket arrives we have enter the ticket number in that sheet and change the color of the cell manually according to the time the ticket arrived for eg. if ticket came in between 8am to 9 am it will be green if it is between 9 am to 10 am then red if it is between 10 am to 11 am then purple so on so instead of changing the color manually i need a formula or a steps so based on current time when the data entered into a cell the color should change please suggest

  • @AnasTeriZenki
    @AnasTeriZenki Рік тому +2

    Thanks for the tutorial, very helpful in my work 😊

  • @arsyanandregate7288
    @arsyanandregate7288 5 місяців тому

    what a useful function, thank you man

  • @Rainstorm121
    @Rainstorm121 21 день тому

    thank you. how can you count all the coloured cells? Note that these are empty cells.

  • @user-zt7id6mu7q
    @user-zt7id6mu7q 5 місяців тому

    hi there, thanks for this function, but I have specific question...what if I want to split the cell for multiple color (let's say I've done several things in one day and marked them differently) but I want to count them all ?

  • @user-pg4hh4kd4t
    @user-pg4hh4kd4t Рік тому +4

    Thank you for this video. I am working within a table and my counts are correct for the current set up, but the counts are not adjusting if I make edits to the colors (such as highlighting an additional cell). Here is my formula: =COUNT_COLOR(Table1[Person],C203). Can you tell me what I am doing wrong?

    • @JopaExcel
      @JopaExcel  Рік тому +1

      Did you do the same as the video? Maybe is the formulas/functions in your spreadsheet are not automatically update. Check this, please. Maybe it can solve the problem.
      To check Calculation Settings: Click on the "Formulas" tab in the Excel ribbon and then, "Calculation". Calculation mode needs to be set as Automatic.
      Hope this can help you.

    • @felipecastruita7955
      @felipecastruita7955 10 місяців тому +4

      I have the same issue and the calculate mode is set as automatic @@JopaExcel , do you know what could be wrong?
      I did the same as the video.

  • @carlotacartola3130
    @carlotacartola3130 4 місяці тому

    Thank you for the video. The function works well when the cells that need to be analyzed are in the same Excel book in which I am making the function run. However, when I try to count the cells using a link to a different excel book, it only works when the referenced spreadsheet is open. If I refresh the excel in which the "COUNT_COLOR" function is being executed while the source excels are closed, I receive a "VALUE" error. I have verified the links, and they are not broken. Do you know how to fix the function so that it also works with references to other excel books?

  • @deedeealltheway1
    @deedeealltheway1 9 місяців тому

    PERFECT!!!! THANK YOU SO MUCH FOR YOUR TUTORIAL

    • @JopaExcel
      @JopaExcel  9 місяців тому

      Glad it helped! Thank you 😁🙏👍

  • @ghostcon
    @ghostcon 3 місяці тому

    Exactly what i needed thanks!

    • @JopaExcel
      @JopaExcel  3 місяці тому

      Glad it helped! 🙏👍

  • @sushh1
    @sushh1 9 місяців тому +2

    How do you select a range of cells that are separate?
    For example, I want to select C1, C4 and C6 but it gives me an error.

  • @richardsiemion5903
    @richardsiemion5903 10 місяців тому

    I need to thank you. This is perfect and I needed it

    • @JopaExcel
      @JopaExcel  10 місяців тому

      Glad it helped you! 🙏👍

  • @AugustMoonchild
    @AugustMoonchild 4 місяці тому +1

    Why mine comes as #NAME?

  • @BeatriceMihaelaPanduru
    @BeatriceMihaelaPanduru 4 місяці тому

    This is amazing, thank you so much!

  • @muralidaranm343
    @muralidaranm343 8 днів тому

    Which one we have to copy and paste

  • @ellaminnowpea
    @ellaminnowpea 5 місяців тому

    Excellent tutorial, thank you!

  • @TamaraHeuts
    @TamaraHeuts 3 дні тому

    I keep getting the message that there is a problem with the formula, when I add the comma and then want to select the cell with the color....

  • @akshaydhingraapj
    @akshaydhingraapj 7 місяців тому +1

    hello! This was a great solution indeed! But is there a way to count cells color for conditionally formatted cells?

    • @MrPolgouder
      @MrPolgouder 7 місяців тому

      I was going to ask the same question. It does not work for cells which changed colour using conditional formatting. Could you please help?

  • @edamerdna
    @edamerdna 13 днів тому

    thanks for sharing...

  • @BCOzSportsGamer
    @BCOzSportsGamer 3 місяці тому

    Is there a way to refresh the count? Seems I have to go into the cell then press enter.

  • @akechelvira1890
    @akechelvira1890 5 місяців тому

    Thank you so much. This helped me alot.

  • @dgoeloe
    @dgoeloe 16 днів тому

    Not working... I get the new function, but then trying to select the cell for the colors, I get an error.

  • @anamariarodriguezcortes8737
    @anamariarodriguezcortes8737 6 місяців тому

    This video was very useful. Thank you!

  • @Smurphyyy
    @Smurphyyy 6 місяців тому +2

    Doesn't work, i permanently get the error that if i put an "=" at the start i need some kind of result or whatever

  • @nancylizetgarciagutierrez4490
    @nancylizetgarciagutierrez4490 Годину тому

    Does not work with conditional rules.

  • @ankitanand8438
    @ankitanand8438 Місяць тому

    Second sheet random boxes are coming counted for me but not the first one shown..

  • @dwerty87great
    @dwerty87great 7 днів тому

    not working for color that applied from conditional formatting

  • @Zhuravi
    @Zhuravi 7 місяців тому

    Thank you so much! Easy and quick!

    • @JopaExcel
      @JopaExcel  7 місяців тому

      Glad it was useful! 🙏👍

  • @PerfectPetz3234-wm7xj
    @PerfectPetz3234-wm7xj 4 місяці тому

    Thank you so much for this!

  • @rstcore885
    @rstcore885 2 місяці тому

    Hi, but what is the functuon if we want to summ/count colors between some dates there? F.e, we need to find sum or count between 19 jul and 27 jul?

  • @kettah
    @kettah 2 місяці тому

    Fantastic! Thanks.

  • @JY-rr7vt
    @JY-rr7vt 7 місяців тому

    Thank you for this tutorial. Very helpful indeed!

  • @santiagodelorenzo8711
    @santiagodelorenzo8711 2 місяці тому

    hi, great tutorial! can you do that with font colours/format?

  • @jilnajil5464
    @jilnajil5464 Місяць тому

    I have created the count color formula as per user instruction but the formula is not found in other file, can you help me to add that formula in whole excel file

  • @snezanasando3519
    @snezanasando3519 5 місяців тому

    Great! It works. Thanks!

  • @NicYan_S
    @NicYan_S 6 місяців тому

    Best, but why when I add new cells with the same colors the count not changed automatically? its stay with count I counted at first

  • @feezitic
    @feezitic 9 місяців тому

    YOU SAVED ME THANK YOU!

    • @JopaExcel
      @JopaExcel  9 місяців тому

      Glad it was useful. Thank you 🙏👍

  • @Curious322
    @Curious322 3 місяці тому

    not working while using conditional formatting, can you help with that?

  • @dearesthb
    @dearesthb 8 місяців тому +1

    hello! this works amazing but is there a way to count cells color for conditionally formatted cells?

    • @tpg5974
      @tpg5974 8 місяців тому

      Agreed!!!! Show me how to do that and I will be ecstatic!!!!!!

  • @vanderwh
    @vanderwh 2 місяці тому

    If I change a color should the total auto update?

  • @yanivnetanel6300
    @yanivnetanel6300 2 місяці тому

    Good idea but there’s one problem
    I don’t have the developer tab up on my screen ….

  • @rezahasan25
    @rezahasan25 2 місяці тому

    Excellent !!!

  • @eunizzzz
    @eunizzzz 9 місяців тому +1

    Error "Compile error: Expected: identifier" appeared, what can I do?

  • @ashkan13541
    @ashkan13541 6 місяців тому

    hi I added the formulation in macro but it doesn't work and massage formulation has a problem, I am using Mac , is there any limitation for the excels which using in Mac?

  • @DailyPositiveShots
    @DailyPositiveShots 3 місяці тому

    Thanks exactly looking for that

    • @JopaExcel
      @JopaExcel  3 місяці тому

      Your welcome. Glad it was useful 🙏👍

  • @lostinbooks6433
    @lostinbooks6433 6 місяців тому

    Hi, it does not work on cells with conditional formatting. Is there a way out? Thanks!

  • @arsalanchishty8985
    @arsalanchishty8985 3 місяці тому

    Hey had a question - I created some conditional formatting to mark some cells if they were blank or not. That part works fine. The colors go brown if they're blank and blue if they have text. But the issue is this code is NOT picking up my conditionally formatted cells for some reason. Any guidance on troubleshooting?

  • @Intellectual_House
    @Intellectual_House 4 місяці тому

    it works for me but the function is not saved , like if i use another excel document I can't find it

  • @michaelwagner9586
    @michaelwagner9586 7 місяців тому

    Code works great if one group of data is selected. Im having an issue when I want to select multiple seperate columns at once. (ie:=COUNT_COLOR(AN2:AN41,AI2:AI55,BI10) where im slecting 2 seperate columns of data. Gives me "value is wrong data type" error. Solutions?

  • @adamlofquist
    @adamlofquist 8 місяців тому

    I just tried this to count the colors in a row and it is not working for me. The formula is working but it is not counting the cells that have a color in them. My example formula is =count_color(B2:H2,J2) is there something I am missing? I have 3 cells that match the color of j2 but it shows up as 0.

  • @vmay002
    @vmay002 2 місяці тому

    Thanks a lot man!

  • @-carlo.7882
    @-carlo.7882 2 місяці тому

    will it work on any version of excel?

  • @florruiz2881
    @florruiz2881 6 місяців тому

    Loveeee❤🎉🎉🎉 thank You so much!

  • @murilofernandes3492
    @murilofernandes3492 5 місяців тому

    Thank you very much!

  • @magdalenaos8215
    @magdalenaos8215 7 місяців тому +1

    Unfortunately excel is telling me that formula is incorrect :(