ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   COUNT HIGHLIGHTED CELLS IN A ROW ? (https://www.excelbanter.com/excel-discussion-misc-queries/203127-count-highlighted-cells-row.html)

Stephen the computer dummy

COUNT HIGHLIGHTED CELLS IN A ROW ?
 
I would like figure out how to add highlighted cells in a row with a
designated cell for the sum. If anyone can help it would make my spreadsheet
much more effective and easier to manage.
Thanks
topcat

Mike H

COUNT HIGHLIGHTED CELLS IN A ROW ?
 
Hi,

You can do it with a UDF. Alt + F11 to open VB editor. Right click 'This
Workbook' and insert module and paste this in

Function SumColours(sumrange As range, colour As Long)
For Each c In sumrange
If c.Interior.ColorIndex = colour And IsNumeric(c) Then
mytot = mytot + c
End If
Next
SumColours = mytot
End Function

On the worksheet call with
=sumcolours(A1:A100,3)

Where A1:A100 is the range to sum
3 is the colour (Red)

If you dont know the colour numbers record a macro of colouring cells


Mike


"Stephen the computer dummy" wrote:

I would like figure out how to add highlighted cells in a row with a
designated cell for the sum. If anyone can help it would make my spreadsheet
much more effective and easier to manage.
Thanks
topcat



All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com