How to sum row color
Closed
Pooja
-
Mar 3, 2016 at 05:46 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - Mar 3, 2016 at 11:44 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen January 16, 2023 - Mar 3, 2016 at 11:44 AM
Related:
- How to sum row color
- Notepad++ background color - Guide
- Html input text color - Guide
- Excel create unique id for each row ✓ - Excel Forum
- Csgo crosshair color - Guide
- How to change netflix subtitle color - Guide
1 reply
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 16, 2023
545
Mar 3, 2016 at 11:44 AM
Mar 3, 2016 at 11:44 AM
Hi Pooja,
Paste the following code in a module (Alt+F11>insert Module>Paste code in big white field):
Then use the formula:
=CountColorNumber(Range of cells, the cell with the color)
So if range A1:A10 has different colors and you want to add the ones that are colored red, then color for example B1 red and type formula in B2:
=CountColorNumber(A1:A10,B1)
Best regards,
Trowa
Paste the following code in a module (Alt+F11>insert Module>Paste code in big white field):
Function CountColorNumber(MyRange As Range, Color As Range) As Long Dim MyColor As Long MyColor = Color.Interior.ColorIndex For Each cell In MyRange If cell.Interior.ColorIndex = MyColor Then CountColorNumber = CountColorNumber + cell.Value End If Next cell End Function
Then use the formula:
=CountColorNumber(Range of cells, the cell with the color)
So if range A1:A10 has different colors and you want to add the ones that are colored red, then color for example B1 red and type formula in B2:
=CountColorNumber(A1:A10,B1)
Best regards,
Trowa