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 December 27, 2022 - Mar 3, 2016 at 11:44 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 3, 2016 at 11:44 AM
Related:
- How to sum row color
- Saints row 2 cheats - Guide
- Notepad++ background color - Guide
- Sound card color code - Guide
- Rg45 color coding - Guide
- Powertoys color picker download - Download - Other
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
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