Summarize only numbers printed in Bold?

A

Anna

Hello,

Is there any way I can make a formula that only summarizes the numbers in one column that are bold? Or one formula that only summarizes the numbers that are written in a cell with a particular Fill Color?

Thankful for all your help!
 
B

Bob Phillips

For the fill colour, see

http://www.xldynamic.com/source/xld.ColourCounter.html
Processing Coloured Cells

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Anna said:
Hello,

Is there any way I can make a formula that only summarizes the numbers in
one column that are bold? Or one formula that only summarizes the numbers
that are written in a cell with a particular Fill Color?
 
P

Peo Sjoblom

That is what it does, to be able to do that you must know what to SUM right?
Bob's function returns the fillcolor index so to sum all red cells use

=SUMPRODUCT(--(colorindex(A1:A100)=3),A1:A100)

or you can use a help column to return the index

=colorindex(A1)

copy down as long as needed then use

=SUMIF(B1:B100,3,A1:A100)

--

Regards,

Peo Sjoblom

(No private emails please, for everyone's
benefit keep the discussion in the newsgroup/forum)


Anna said:
I would like to summarize the numbers that are in the coloured cells, not
the number of coloured cells. Is there anyway of doing this?
 
B

Bob Phillips

Thanks Peo, will update the page to make this clearer for people.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

Anna

Hi!
Thank you so much guys! It really helped alot!
Is there anyway I can do the same thing, but instead of summarizing all the numbers with a specific cell color I summarize the numbers written with bold text?
Thanks again!

"Gord Dibben" skrev:
 
B

Bob Phillips

Anna,

Here is a variant of the ColorIndex solution. Again, you use SUMPRODUCT to
count or sum

Count: =SUMPRODUCT(--(boldrange(A1:A3)))

Sum: =SUMPRODUCT(--(boldrange(A1:A3)),A1:A3)

'---------------------------------------------------------------------
Function BoldRange(rng As Range) As Variant
'---------------------------------------------------------------------
Dim cell As Range, row As Range
Dim i As Long, j As Long
Dim iWhite As Long, iBlack As Long
Dim aryBold As Variant

If rng.Areas.Count > 1 Then
BoldRange = CVErr(xlErrValue)
Exit Function
End If

If rng.Cells.Count = 1 Then
Set BoldRange = rng

Else
aryBold = rng.Value
i = 0

For Each row In rng.Rows
i = i + 1
j = 0

For Each cell In row.Cells
j = j + 1

aryBold(i, j) = cell.Font.Bold

Next cell

Next row

End If

BoldRange = aryBold

End Function




--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Anna said:
Hi!
Thank you so much guys! It really helped alot!
Is there anyway I can do the same thing, but instead of summarizing all
the numbers with a specific cell color I summarize the numbers written with
bold text?
 
B

B.Esbaum

I can't get a "colorindex" formula to work. What do I need to do to get the
formula below to work? =colorindex(A1) ? ? ?
 
Top