View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default sumif and strike through

You will need a User Defined Function for this.

Public Function SumNoStrike(rngSumRange As Range) As Single
Dim rngCell As Range
For Each rngCell In rngSumRange
If IsNumeric(rngCell.Value) Then
If rngCell.Font.Strikethrough = False Then
SumNoStrike = SumNoStrike + rngCell.Value
End If
End If
Next rngCell
End Function

Usage is.......=SumNoStrike(A1:A20)

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the above code in there. Save the
workbook and hit ALT + Q to return to Excel window.

Enter the formula as shown above.


Gord Dibben Excel MVP

On Thu, 14 Dec 2006 11:22:01 -0800, baklava
wrote:

I have a column of numbers that I want to total; however, some of the rows
have the number struck through - these are the numbers I DO NOT want to
include in the total.

=sumif(a1:a20, and here is where I get stuck. How do I tell excel to sum
all the numbers in the range except those that have strike through.

Or is there a different formula to use?

Thanx!


Gord Dibben MS Excel MVP