Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Problems with summing

Hi

I use the following code to sum the values of all numbers that appear in
column F:

Set Rng = Range("F1").End(xlDown)(2, 1)
Rng.Formula = "=SUM(F1:" & Rng(0, 1).Address(False, False) & ")"

The value that is returned is always 0 even though this is not the figure
that should be appearing. I use a similar piece of code and it works without
problem.

My first thought was that there may be a problem with the formatting of the
numbers, however, when I do a basic summing of two individual cells that
appear in that column (F100+F101) the formula works without problem.

Any ideas as to what might be the problem ?

Thanks
Sean

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Problems with summing

Hi
what does the manual entered formula
=SUM(F100:F101)
return?
I would assume these values are stored as 'Text'. The formula
=F100+F101
converts these values automatically to real number but SUM does not do
this

--
Regards
Frank Kabel
Frankfurt, Germany

"Sean" schrieb im Newsbeitrag
...
Hi

I use the following code to sum the values of all numbers that appear

in
column F:

Set Rng = Range("F1").End(xlDown)(2, 1)
Rng.Formula = "=SUM(F1:" & Rng(0, 1).Address(False, False) & ")"

The value that is returned is always 0 even though this is not the

figure
that should be appearing. I use a similar piece of code and it works

without
problem.

My first thought was that there may be a problem with the formatting

of the
numbers, however, when I do a basic summing of two individual cells

that
appear in that column (F100+F101) the formula works without problem.

Any ideas as to what might be the problem ?

Thanks
Sean


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Problems with summing

Thanks for your response Frank. Sum(F100:101) returns 0 whilst F100+F101
returns the correct value (1050.00).

Is there any way of formatting a column to real numbers ? If so, is it
possible to do it via a piece of code ?

Thanks
Sean

"Frank Kabel" wrote:

Hi
what does the manual entered formula
=SUM(F100:F101)
return?
I would assume these values are stored as 'Text'. The formula
=F100+F101
converts these values automatically to real number but SUM does not do
this

--
Regards
Frank Kabel
Frankfurt, Germany

"Sean" schrieb im Newsbeitrag
...
Hi

I use the following code to sum the values of all numbers that appear

in
column F:

Set Rng = Range("F1").End(xlDown)(2, 1)
Rng.Formula = "=SUM(F1:" & Rng(0, 1).Address(False, False) & ")"

The value that is returned is always 0 even though this is not the

figure
that should be appearing. I use a similar piece of code and it works

without
problem.

My first thought was that there may be a problem with the formatting

of the
numbers, however, when I do a basic summing of two individual cells

that
appear in that column (F100+F101) the formula works without problem.

Any ideas as to what might be the problem ?

Thanks
Sean



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Problems with summing

Hi
try the following macro (processes the current selection)

sub convert_it
with selection
.value=.value
end with
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

"Sean" schrieb im Newsbeitrag
...
Thanks for your response Frank. Sum(F100:101) returns 0 whilst

F100+F101
returns the correct value (1050.00).

Is there any way of formatting a column to real numbers ? If so, is

it
possible to do it via a piece of code ?

Thanks
Sean

"Frank Kabel" wrote:

Hi
what does the manual entered formula
=SUM(F100:F101)
return?
I would assume these values are stored as 'Text'. The formula
=F100+F101
converts these values automatically to real number but SUM does not

do
this

--
Regards
Frank Kabel
Frankfurt, Germany

"Sean" schrieb im Newsbeitrag
...
Hi

I use the following code to sum the values of all numbers that

appear
in
column F:

Set Rng = Range("F1").End(xlDown)(2, 1)
Rng.Formula = "=SUM(F1:" & Rng(0, 1).Address(False, False) & ")"

The value that is returned is always 0 even though this is not

the
figure
that should be appearing. I use a similar piece of code and it

works
without
problem.

My first thought was that there may be a problem with the

formatting
of the
numbers, however, when I do a basic summing of two individual

cells
that
appear in that column (F100+F101) the formula works without

problem.

Any ideas as to what might be the problem ?

Thanks
Sean




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
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
Summing Catherine Excel Worksheet Functions 2 April 24th 07 08:47 PM
PivotTable and summing/not summing ~*Amanda*~[_2_] Excel Discussion (Misc queries) 1 March 14th 07 07:35 PM
Problems merging an excel file due to code or file problems? Cindy M -WordMVP- Excel Programming 0 September 14th 04 02:58 PM
Summing No Name Excel Programming 5 June 15th 04 11:36 PM


All times are GMT +1. The time now is 12:33 PM.

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

About Us

"It's about Microsoft Excel"