Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,069
Default Summing only numbers, not formulas

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


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default Summing only numbers, not formulas

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




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Summing only numbers, not formulas

First install this tiny UDF:

Function noformula(r As Range) As Boolean
noformula = Not r.hasformula
End Function

Then, if your data is in column A,from A1 thru A100, in B1 enter:

=noformula(A1) and copy down

Finally enter:

=SUMPRODUCT((A1:A100)*(B1:B100))
--
Gary''s Student - gsnu200832


"John" wrote:

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


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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





  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default Summing only numbers, not formulas

I did not think about cells having text, sorry
Glad you solved it
all the best
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"John" wrote in message
...
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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summing a group of numbers Barbie Da New Users to Excel 2 June 28th 08 10:36 PM
Summing numbers Gingit Excel Discussion (Misc queries) 2 October 7th 06 12:31 AM
Keep getting #### when summing numbers Ammy Excel Discussion (Misc queries) 2 June 15th 06 06:40 AM
summing more than 30 numbers stevientx Excel Discussion (Misc queries) 5 March 10th 06 02:36 PM
Summing Numbers Dave C. Excel Discussion (Misc queries) 1 February 24th 05 03:56 PM


All times are GMT +1. The time now is 06:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"