Summings cells in Italics

L

Luke

Is there a way to sum ONLY the values in Italics in a column of data?

Any help would be most appreciated
 
C

Chip Pearson

Luke,

This can be done only with VBA code:

Function SumItalics(InputRange As Range) As Double
Dim Total As Double
Dim Rng As Range
For Each Rng In InputRange.Cells
If IsNumeric(Rng.Value) = True Then
If Rng.Font.Italic = True Then
Total = Total + Rng.Value
End If
End If
Next Rng
End Function

You can call this from a cell with a formula like

=SumItalics(A1:A100)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)
 
B

Bob Phillips

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
B

Bob Phillips

Only by VBA

Sub SumItalics()
Dim cell As Range
Dim tmp

For Each cell In Columns(12).Cells
If cell.Font.Italic Then
tmp = tmp + cell.Value
End If
Next cell
MsgBox tmp
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Top