Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default SUM() function not behaving

I have a series of columns with sums at the top of each using the SUM()
function. I want to run the subtotal command across them from VBA using range
("a1")= Worksheetfunction.subtotal(5, Range). But I keep getting back a zero
for the result although the columns have numbers in them. Is this due to a
flaw with trying to use the SUM() Function or have I gone Crazy.

Jeff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default SUM() function not behaving

Hi
what is your exact code and how have you defined 'range'

--
Regards
Frank Kabel
Frankfurt, Germany

jeff wrote:
I have a series of columns with sums at the top of each using the
SUM() function. I want to run the subtotal command across them from
VBA using range ("a1")= Worksheetfunction.subtotal(5, Range). But I
keep getting back a zero for the result although the columns have
numbers in them. Is this due to a flaw with trying to use the SUM()
Function or have I gone Crazy.

Jeff



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SUM() function not behaving

Subtotal(5,range) says to return the Minumum value in the range. Is one of
the the cells being subtotalled returning a zero?

--
Regards,
Tom Ogilvy

"jeff" wrote in message
...
I have a series of columns with sums at the top of each using the SUM()
function. I want to run the subtotal command across them from VBA using

range
("a1")= Worksheetfunction.subtotal(5, Range). But I keep getting back a

zero
for the result although the columns have numbers in them. Is this due to a
flaw with trying to use the SUM() Function or have I gone Crazy.

Jeff



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default SUM() function not behaving

Neither. You probably pasted your "numbers" in from somewhere else (a
web site?) and they were entered as Text (same thing happens if you
enter the numbers with the cells preformatted as Text). SUM() ignores
text.

To check, copy an empty cell, select your numbers. Choose Edit/Paste
Special, selecting the Values and Add radio buttons. Click OK.

This will coerce Text numbers to actual number values.



In article ,
"jeff" wrote:

I have a series of columns with sums at the top of each using the SUM()
function. I want to run the subtotal command across them from VBA using range
("a1")= Worksheetfunction.subtotal(5, Range). But I keep getting back a zero
for the result although the columns have numbers in them. Is this due to a
flaw with trying to use the SUM() Function or have I gone Crazy.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default SUM() function not behaving

Well having a SUM() or any other formula in the Range should not affect
the subtotal.

It might be possible that one the SUM() is returning "0"
or the range you specified in Subtotal includes a cell haveing value "0"

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default SUM() function not behaving

I've tried using the following:
xlApp.Range("g28") = xlApp.WorksheetFunction.Subtotal(5,
xlApp.Workbooks("Release Plan
(1,2,3,4).xls").Worksheets(ShtRef).Range(myAddr))

Then I went to the specific sheet and did a subtotal locally and still got
the same answer.

Also I've discovered that Excel 2002 help is prone to errors, it says:
Index Meaning
1 Automatic
2 Sum
3 Count
4 Average
5 Max
6 Min
7 Product
8 Count Nums
9 StdDev
10 StdDevp
11 Var
12 Varp

When in Fact "4" RETURNS the highest value
Jeff

"Sharad" wrote:

Well having a SUM() or any other formula in the Range should not affect
the subtotal.

It might be possible that one the SUM() is returning "0"
or the range you specified in Subtotal includes a cell haveing value "0"

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SUM() function not behaving

This is what it actually says:

1 AVERAGE
2 COUNT
3 COUNTA
4 MAX
5 MIN
6 PRODUCT
7 STDEV
8 STDEVP
9 SUM
10 VAR
11 VARP

Not sure where you are looking.

--
Regards,
Tom Ogilvy


"Jeff" wrote in message
...
I've tried using the following:
xlApp.Range("g28") = xlApp.WorksheetFunction.Subtotal(5,
xlApp.Workbooks("Release Plan
(1,2,3,4).xls").Worksheets(ShtRef).Range(myAddr))

Then I went to the specific sheet and did a subtotal locally and still got
the same answer.

Also I've discovered that Excel 2002 help is prone to errors, it says:
Index Meaning
1 Automatic
2 Sum
3 Count
4 Average
5 Max
6 Min
7 Product
8 Count Nums
9 StdDev
10 StdDevp
11 Var
12 Varp

When in Fact "4" RETURNS the highest value
Jeff

"Sharad" wrote:

Well having a SUM() or any other formula in the Range should not affect
the subtotal.

It might be possible that one the SUM() is returning "0"
or the range you specified in Subtotal includes a cell haveing value "0"

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
Find Function behaving differently in different spreadsheets Anchor Excel Worksheet Functions 1 November 19th 09 08:55 AM
Getpivotdata behaving flaky conniemm Excel Worksheet Functions 0 September 15th 07 12:06 AM
Cursor not behaving southwood Excel Discussion (Misc queries) 3 July 16th 06 01:37 AM
OFFSET behaving oddly Ryan Poth Excel Worksheet Functions 2 May 30th 06 07:29 AM
Set Target cell is not behaving meinfs Excel Programming 1 September 14th 03 05:01 PM


All times are GMT +1. The time now is 08:05 PM.

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"