top of page
Writer's pictureDp

How to count colored cells in MS Excel

Updated: Jun 20, 2020

In this tutorial, let's learn How to count colored cells in MS Excel.

Here, we would be using the VBA method and this is the most easiest method to count colored cells in MS excel.


This is the example that I would like to show you now and let us count the number of red and orange colored cells.


First, go to VBA window by pressing Alt+F11 shortcut.


1. You will land into this VBA window now.

2. Click on Insert>> Module to insert a new module.

3. Copy the below code and paste it here in the module.

Function GetColorCount(CountRange As Range, CountColor As Range) 
Dim CountColorValue As Integer 
Dim TotalCount As Integer 
CountColorValue = CountColor.Interior.ColorIndex 
Set rCell = CountRange 
For Each rCell In CountRange   
If rCell.Interior.ColorIndex = CountColorValue Then     
TotalCount = TotalCount + 1   
End If 
Next rCell 
GetColorCount = TotalCount 
End Function

4. Save your excel and close this VBA window and go back to the Excel sheet.


Using this VBA code, we have created a custom function called "Getcolorcount"


And this function can be used like any other function now.


Here, we have two colors red and orange in the sheet.


In J4 Cell, type the formula as =getcolorcount(F5:F38,I4)

here, F4:F38 represents the data which to be counted and

I4 is the background color, what to be counted.


Press enter and you will get the result as 9. You can cross verify the figure whether it is right or not.


Similarly, let us count the red colored cells by typing formula in cell J5 as =getcolorcount(F5:F38,I5) and press enter to see the result as 8.


So friends, this is all about the How to count colored cells in MS Excel.


Watch this video tutorial for better understanding:


If you liked this tutorial, share it with your friends. And also you can follow us on Youtube, Twitter and Facebook. We would love to hear from you, Please do comment, suggest or compliment our work and we shall make it better for you. You can write us at dptutorials15@gmail.com


***********************************************

★ My Online Tutorials ► https://www.dptutorials.com


LEARNING RESOURCES I Recommend: https://www.dptutorials.com/resources


Subscribe for more Awesome Tutorials: http://goo.gl/NyAtg2


Support the Channel via shopping: http://ift.tt/2jH38PR


Tools for youtube vlogging:


• Screen recorder: https://techsmith.pxf.io/2BMjA

• Harison Softbox Studio Lights: https://amzn.to/3caGbzg http://fkrt.it/ypCaRQNNNN

• Background Support Stand: https://amzn.to/3dbACSv http://fkrt.it/A3cCb_uuuN

• Acoustic Foam Background: https://amzn.to/3gzFtyC http://fkrt.it/ypsGdQNNNN


Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!


***********************************************


You Can Connect with Me at:


Follow:


0 comments

Recent Posts

See All

Comments


bottom of page