Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default preferred method for summing

just a general question, is there a preferred method?

if i use an array or loop to get numbers, sum those numbers and then place the
sum in the cell, is it better to:

1. put each value in the cell and add each subsequent value to it or,
2. store the numbers in a variable and then just place the value of the variable
in the cell when it's complete?

in this instance, there's no real speed issue, it takes a second to do what i'm
doing, but just curious what the professionals do.
--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default preferred method for summing

this is just my personal opinion as I can't speak from the authoritative
position so many others can, but
writing to a cell takes a long time compared to writing to a variable.

Every command is a speed issue from the perspective that when you begin to
combine them, the delays accumulate.

--
Regards,
Tom Ogilvy


"Gary Keramidas" wrote:

just a general question, is there a preferred method?

if i use an array or loop to get numbers, sum those numbers and then place the
sum in the cell, is it better to:

1. put each value in the cell and add each subsequent value to it or,
2. store the numbers in a variable and then just place the value of the variable
in the cell when it's complete?

in this instance, there's no real speed issue, it takes a second to do what i'm
doing, but just curious what the professionals do.
--


Gary




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default preferred method for summing

Speaking personally, I would go for #2. I try to avoid interacting with the
worksheet/workbook until I have to

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
just a general question, is there a preferred method?

if i use an array or loop to get numbers, sum those numbers and then place

the
sum in the cell, is it better to:

1. put each value in the cell and add each subsequent value to it or,
2. store the numbers in a variable and then just place the value of the

variable
in the cell when it's complete?

in this instance, there's no real speed issue, it takes a second to do

what i'm
doing, but just curious what the professionals do.
--


Gary





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default preferred method for summing

One additional note: use natvie Excel functionality rather than doing things stepwise. For example,
if you want to sum the 1000 numbers in column A, rather than

For i = 1 to 1000
mySum = mySum + Cells(i,1).Value
next i

Range("A1001").Value = mySum

just use

Range("A1001").Value = Application.Sum(Range("A1:A1000"))

HTH,
Bernie
MS Excel MVP


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
just a general question, is there a preferred method?

if i use an array or loop to get numbers, sum those numbers and then place the sum in the cell, is
it better to:

1. put each value in the cell and add each subsequent value to it or,
2. store the numbers in a variable and then just place the value of the variable in the cell when
it's complete?

in this instance, there's no real speed issue, it takes a second to do what i'm doing, but just
curious what the professionals do.
--


Gary





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default preferred method for summing

ok, thanks everyone.

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
just a general question, is there a preferred method?

if i use an array or loop to get numbers, sum those numbers and then place the
sum in the cell, is it better to:

1. put each value in the cell and add each subsequent value to it or,
2. store the numbers in a variable and then just place the value of the
variable in the cell when it's complete?

in this instance, there's no real speed issue, it takes a second to do what
i'm doing, but just curious what the professionals do.
--


Gary





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
Is there a preferred protocol for alignment of numbers in a colum Michelle Excel Discussion (Misc queries) 3 December 15th 09 03:54 PM
Adjusting numbers to nearest preferred number BRob Excel Worksheet Functions 1 May 1st 08 11:16 AM
Summing multiple hits using match, offset and index method [email protected] Excel Programming 2 March 8th 06 09:35 AM
preferred app? nastech Excel Discussion (Misc queries) 0 November 25th 05 03:16 PM
What is the best method for summing values where you want 2 value. Susan F. Excel Discussion (Misc queries) 2 March 25th 05 07:03 PM


All times are GMT +1. The time now is 11:52 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"