Thread: Sum Italics
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Sum Italics

My point about using the extra column is this: Say that you have values in column B, some of which
you want to count or sum. Instead of selecting, say, cell B10 and italicizing the cell, select cell
C10 and enter an X. Then use the formulas

=SUMIF(C1:C1000,"X",B1:B1000)
=COUNTIF(C1:C1000,"X")

You can use a VBA function:

Function SumI(rR As Range) As Double
Dim rC As Range
SumI = 0
For Each rC In rR
If rC.Font.Italic Then SumI = SumI + rC.Value
Next rC
End Function

used like

=SUMI(B2:B10)

But chaning a font doesn't trigger a re-calc, so you would need to force a re-calc for this to work.


HTH,
Bernie
MS Excel MVP


"Mathew P Bennett" wrote in message
...
Thanks Bernie,
No, no difference between the values except italicized/normal (font, size, colour all same),
though could instruct the user tochange the font colour, (instead of using italics), if that
would make things easier.
I did not really get your point about using an extra column.

Cheers for your prompt reply.
I did think about using the colourfunction (which I like), but can I adapt that for
'colourfontfunction' ?
Cheers
Mathew

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Matthew,

Is there something about the italicized values that you can determine by other than visually
looking at them, or checking their font? Are they all negative, or greater than 100, or....

Anyway, lacking logic to select those values, a far better option would be to use another column,
and enter a value that could be checked, using a SUMIF / COUNTIF to get your values. Think of
the person who will inherit this workbook.....

HTH,
Bernie
MS Excel MVP


"Mathew P Bennett" wrote in message
...
Good Evening All,
I have a ss (cash flow) where some of the values are entered as italics, and the rest as normal.

I would like to be able to differenciate between the two when using a count function, plus using
the sum
function (but not together)
I thought of using an array, something like this, (or maybe a sumproduct)

ie SUM{(IF(A1:A10<Italics,FALSE,A1:10))}

I feel sure some VBA will be needed.

Any help or pointers would be most appreciated.
Cheers
Mathew