Summings cells in Italics

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Any help would be most appreciated
 
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)
 
--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
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)
 
Back
Top