Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Slow Calculating and optimizing

Hi

I have been using the expression =SUMPRODUCT(--(file'!$P$1:$P
$65500="txt");'file'!$H$1:$H$65500)
to summarize all cells in column H where column P= "txt"

I have 1200 of theese expressions and it make the startup and
recalculating very slow (3-4 minutes)

The 65500 is choosed to be sure that I never ran out of Data and it
was not based on an analyze.

To optimize this cut the 65500 down to a relevant size ( ex. 10000)
and then the calculation time is reduced dramatically.

regards

Kurt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default Slow Calculating and optimizing

Hi Kurt

Try creating dynamic ranges for your data
For example
Insertnamedefine Name colP Refers to =OFFSET($P$1,0,0,COUNTA($P:$P))

Repeat for colH

Then use
=SUMPRODUCT(--(colP=".txt");--(ColH))

To ensure that all of your ranges have the same length, use COUNTA($P:$P) in
all cases, or whichever column will not have any blank data within it

I usually prefer to have one named variable lrow where I would set it as
=COUNTA($P:$P)
Then all the other named ranges would be, for example
=OFFSET($P$1,0,0,lrow)

--
Regards
Roger Govier



"kurt" wrote in message
ps.com...
Hi

I have been using the expression =SUMPRODUCT(--(file'!$P$1:$P
$65500="txt");'file'!$H$1:$H$65500)
to summarize all cells in column H where column P= "txt"

I have 1200 of theese expressions and it make the startup and
recalculating very slow (3-4 minutes)

The 65500 is choosed to be sure that I never ran out of Data and it
was not based on an analyze.

To optimize this cut the 65500 down to a relevant size ( ex. 10000)
and then the calculation time is reduced dramatically.

regards

Kurt



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Slow Calculating and optimizing

While Roger gives good advice for dynamic ranges, in this case, you don't
need to us sumproduct at all. Since you only have one condition, the much,
much faster

=Sumif('file'!P:P,"txt",'File'!H:H)

would work fast and doesn't restrict your range.

If 'file" will be closed, then Sumif does not work against a closed workbook
and you would have to go with Sumproduct and perhaps use Roger's suggestion.

--
Regards,
Tom Ogilvy


"Roger Govier" wrote:

Hi Kurt

Try creating dynamic ranges for your data
For example
Insertnamedefine Name colP Refers to =OFFSET($P$1,0,0,COUNTA($P:$P))

Repeat for colH

Then use
=SUMPRODUCT(--(colP=".txt");--(ColH))

To ensure that all of your ranges have the same length, use COUNTA($P:$P) in
all cases, or whichever column will not have any blank data within it

I usually prefer to have one named variable lrow where I would set it as
=COUNTA($P:$P)
Then all the other named ranges would be, for example
=OFFSET($P$1,0,0,lrow)

--
Regards
Roger Govier



"kurt" wrote in message
ps.com...
Hi

I have been using the expression =SUMPRODUCT(--(file'!$P$1:$P
$65500="txt");'file'!$H$1:$H$65500)
to summarize all cells in column H where column P= "txt"

I have 1200 of theese expressions and it make the startup and
recalculating very slow (3-4 minutes)

The 65500 is choosed to be sure that I never ran out of Data and it
was not based on an analyze.

To optimize this cut the 65500 down to a relevant size ( ex. 10000)
and then the calculation time is reduced dramatically.

regards

Kurt




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Slow Calculating and optimizing

There is a trade off to be had if you use the dynamic named range in that
offset is a volatile function. That means that all 1,200 functions become
volatile and while they will calculate faster they will also calculate more
often. This strategy could work for you or against you depending on the time
savings. If it does not work out then you might want to consider using some
code to redefine the range names when then overall number of rows of source
data increases or decreases.
--
HTH...

Jim Thomlinson


"Roger Govier" wrote:

Hi Kurt

Try creating dynamic ranges for your data
For example
Insertnamedefine Name colP Refers to =OFFSET($P$1,0,0,COUNTA($P:$P))

Repeat for colH

Then use
=SUMPRODUCT(--(colP=".txt");--(ColH))

To ensure that all of your ranges have the same length, use COUNTA($P:$P) in
all cases, or whichever column will not have any blank data within it

I usually prefer to have one named variable lrow where I would set it as
=COUNTA($P:$P)
Then all the other named ranges would be, for example
=OFFSET($P$1,0,0,lrow)

--
Regards
Roger Govier



"kurt" wrote in message
ps.com...
Hi

I have been using the expression =SUMPRODUCT(--(file'!$P$1:$P
$65500="txt");'file'!$H$1:$H$65500)
to summarize all cells in column H where column P= "txt"

I have 1200 of theese expressions and it make the startup and
recalculating very slow (3-4 minutes)

The 65500 is choosed to be sure that I never ran out of Data and it
was not based on an analyze.

To optimize this cut the 65500 down to a relevant size ( ex. 10000)
and then the calculation time is reduced dramatically.

regards

Kurt




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default Slow Calculating and optimizing

Hi

Whilst I agree entirely with Tom's advice to the OP about SUMIF, and that
this would speed up the calculations far more, and with your point about
volatility using OFFSET, I thought after posting, I should have offered the
OP INDEX instead as a non-volatile solution.
I went out immediately after posting and have only just returned.

Again define lrow as per my previous posting =COUNTA($P:$P)
Then use the following for the column name colP
=$P$1:INDEX($P:$P,lrow)

--
Regards
Roger Govier



"Jim Thomlinson" wrote in message
...
There is a trade off to be had if you use the dynamic named range in that
offset is a volatile function. That means that all 1,200 functions become
volatile and while they will calculate faster they will also calculate
more
often. This strategy could work for you or against you depending on the
time
savings. If it does not work out then you might want to consider using
some
code to redefine the range names when then overall number of rows of
source
data increases or decreases.
--
HTH...

Jim Thomlinson


"Roger Govier" wrote:

Hi Kurt

Try creating dynamic ranges for your data
For example
Insertnamedefine Name colP Refers to
=OFFSET($P$1,0,0,COUNTA($P:$P))

Repeat for colH

Then use
=SUMPRODUCT(--(colP=".txt");--(ColH))

To ensure that all of your ranges have the same length, use COUNTA($P:$P)
in
all cases, or whichever column will not have any blank data within it

I usually prefer to have one named variable lrow where I would set it
as
=COUNTA($P:$P)
Then all the other named ranges would be, for example
=OFFSET($P$1,0,0,lrow)

--
Regards
Roger Govier



"kurt" wrote in message
ps.com...
Hi

I have been using the expression =SUMPRODUCT(--(file'!$P$1:$P
$65500="txt");'file'!$H$1:$H$65500)
to summarize all cells in column H where column P= "txt"

I have 1200 of theese expressions and it make the startup and
recalculating very slow (3-4 minutes)

The 65500 is choosed to be sure that I never ran out of Data and it
was not based on an analyze.

To optimize this cut the 65500 down to a relevant size ( ex. 10000)
and then the calculation time is reduced dramatically.

regards

Kurt






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
Lessons from optimizing a slow spreadsheet Robbro Excel Discussion (Misc queries) 2 February 25th 10 06:20 PM
worksheet calculating SLOW Jase Excel Discussion (Misc queries) 2 May 14th 08 01:20 AM
Very Slow Calculating Tufail Excel Discussion (Misc queries) 4 December 28th 07 11:04 PM
Calculating is very slow TonyL Excel Discussion (Misc queries) 3 February 13th 07 11:13 PM
Microsoft request for slow-calculating workbooks Charles Williams Excel Programming 0 March 1st 06 09:06 AM


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