View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John John is offline
external usenet poster
 
Posts: 2,069
Default Summing only numbers, not formulas

I had to change the if stmt to
If IsNumeric(mycell) And Not mycell.HasFormula Then
in order not to get a #VALUE! error if cell had text.
This works fine now. Thx so much, John

"Bernard Liengme" wrote:

Can be done with VBA function

Function mysum(myrange)
For Each mycell In myrange
If Not mycell.HasFormula Then
mysum = mysum + mycell
End If
Next
End Function

Called from worksheet with =mysum(H1:H100) , for example

New to VBA? See David McRitchie's site on "getting started" with VBA

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

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"John" wrote in message
...
How do I write a SUMIF fcn that will only sum the cells of a column that
contain only numbers. I do not want to include numbers that are
calculated
by a formula.

I appreciate your help, -John