ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Summings cells in Italics (https://www.excelbanter.com/excel-discussion-misc-queries/143762-summings-cells-italics.html)

Luke

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

Any help would be most appreciated

Chip Pearson

Summings cells in Italics
 
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)



"Luke" wrote in message
...
Is there a way to sum ONLY the values in Italics in a column of data?

Any help would be most appreciated




Bob Phillips

Summings cells in Italics
 


--
HTH

Bob

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

"Luke" wrote in message
...
Is there a way to sum ONLY the values in Italics in a column of data?

Any help would be most appreciated




Bob Phillips

Summings cells in Italics
 
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)

"Luke" wrote in message
...
Is there a way to sum ONLY the values in Italics in a column of data?

Any help would be most appreciated





All times are GMT +1. The time now is 07:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com