Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Is there a preferred protocol for alignment of numbers in a colum | Excel Discussion (Misc queries) | |||
Adjusting numbers to nearest preferred number | Excel Worksheet Functions | |||
Summing multiple hits using match, offset and index method | Excel Programming | |||
preferred app? | Excel Discussion (Misc queries) | |||
What is the best method for summing values where you want 2 value. | Excel Discussion (Misc queries) |