Cell Color Count with a condition
Closed
Manu
-
Apr 2, 2017 at 08:53 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - Apr 3, 2017 at 11:39 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - Apr 3, 2017 at 11:39 AM
Related:
- Cell Color Count with a condition
- Count if cell contains number - Excel Forum
- Excel conditional formatting if another cell contains specific text ✓ - Excel Forum
- If cell contains text then return value multiple conditions ✓ - Excel Forum
- Excel if cell color is red then - Guide
- Notepad++ background color - Guide
1 reply
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 16, 2023
545
Apr 3, 2017 at 11:39 AM
Apr 3, 2017 at 11:39 AM
Hi manu,
You didn't provide any specifics, but use the following code to count the number of yellow cells in the range A1:A10:
Use the macro recorder to find the color code for other colors.
To count cell with specific text, you can use a formula:
=COUNTIF(B1:B10;"MyText")
Best regards,
Trowa
You didn't provide any specifics, but use the following code to count the number of yellow cells in the range A1:A10:
Sub RunMe() Dim x As Integer For Each cell In Range("A1:A10") If cell.Interior.Color = 65535 Then x = x + 1 End If Next cell MsgBox "There are " & x & " yellow cells." End Sub
Use the macro recorder to find the color code for other colors.
To count cell with specific text, you can use a formula:
=COUNTIF(B1:B10;"MyText")
Best regards,
Trowa