any function or statement through which i can calculate total number of values written in red .
any function or statement through which i can calculate total number of values written in red .
Use this UDF:
And in cell type:![]()
Function SumByColor(CellColor As Range, SumRange As Range) Dim myCell As Range Dim iCol As Integer Dim myTotal As Long iCol = CellColor.Font.ColorIndex ' get the target color For Each myCell In SumRange ' lok at each cell in the designated range 'if the cell color matches the target color If myCell.Font.ColorIndex = iCol Then ' add the value in the cell to the total 'If myCell >= iCol Then myTotal = WorksheetFunction.Sum(myCell) + myTotal 'End If End If Next myCell SumByColor = myTotal End Function
Formula:
=SumByColor(C3, $C$1:$C$9)
Where C3 is example of cell you want to sum like (for example with red font, or with black font)
and C1:C9 is a range to SUM
Never use Merged Cells in Excel
Thanks for reply.... When i open the workbook it gives #NAME error ...... will you please solve it .
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks