Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default How to use SUMPRODUCT in VBA

Hi,
I have a large sheets containing 4700 rows of data with more the 700
unique code numbers.
I tried to use pivot table to get summary but it has limitations due to
which many code numbers are not displayed in the pivot tables.

Then, I tried to use sumproduct formula in cells but due to large
numbers of fumproduct formula, sheet became very slow.

So now I was trying to acheive the same results as of pivot table thru
VBA solution hoping that it might improve the performance.
Kindly let me know how to use the sumproduct formula in VBA.
My cell formula is as below.

=SUMPRODUCT(-(ALVXXL01!$B$2:$B$65536=A5),-(ALVXXL01!$K$2:$K$65536="MMV3"),(ALVXXL01!$P$2:$P$ 655360),ALVXXL01!$P$2:$P$65536)

If there is any better alternative, kindly let me know.

Thanks,
Madiya

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default How to use SUMPRODUCT in VBA


Range("d1") =
Evaluate("SUMPRODUCT(--(ALVXXL01!$B$2:$B$65536=A5),--(ALVXXL01!$K$2:$K$65536=""MMV3""),--(ALVXXL01!$P$2:$P$655360),--(ALVXXL01!$P$2:$P$65536))")


"Madiya" wrote:

Hi,
I have a large sheets containing 4700 rows of data with more the 700
unique code numbers.
I tried to use pivot table to get summary but it has limitations due to
which many code numbers are not displayed in the pivot tables.

Then, I tried to use sumproduct formula in cells but due to large
numbers of fumproduct formula, sheet became very slow.

So now I was trying to acheive the same results as of pivot table thru
VBA solution hoping that it might improve the performance.
Kindly let me know how to use the sumproduct formula in VBA.
My cell formula is as below.

=SUMPRODUCT(-(ALVXXL01!$B$2:$B$65536=A5),-(ALVXXL01!$K$2:$K$65536="MMV3"),(ALVXXL01!$P$2:$P$ 655360),ALVXXL01!$P$2:$P$65536)

If there is any better alternative, kindly let me know.

Thanks,
Madiya


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default How to use SUMPRODUCT in VBA

Thanks for your reply. It works great.
But this works only for one cell i.e. static. I need to have a dynamic
formula.
Let me explain.
I have 22 cloumns (fixed) in my data sheet. 2nd col is having mat codes
(may repeat in subsequent rows)
No of rows is variable but above 5000.


I have extracted and listed unique mat codes from data sheet to this
summary sheet in col A.
There are 4 variables (<0, 0, MMV3, MDA1)
I need to use this formula against each unique mat code in a new sheet
called Summary.
Col C is with MMV3 and <0
Col D is with MMV3 and 0
Col E is with MDA1 and <0
Col F is with MDA1 and 0

I can use vlookup or other regular formula in VBA but SUMPRODUCT is not
woking dynamic.

How can I do it?

Regards,
Madiya


Toppers wrote:
Range("d1") =
Evaluate("SUMPRODUCT(--(ALVXXL01!$B$2:$B$65536=A5),--(ALVXXL01!$K$2:$K$65536=""MMV3""),--(ALVXXL01!$P$2:$P$655360),--(ALVXXL01!$P$2:$P$65536))")


"Madiya" wrote:

Hi,
I have a large sheets containing 4700 rows of data with more the 700
unique code numbers.
I tried to use pivot table to get summary but it has limitations due to
which many code numbers are not displayed in the pivot tables.

Then, I tried to use sumproduct formula in cells but due to large
numbers of fumproduct formula, sheet became very slow.

So now I was trying to acheive the same results as of pivot table thru
VBA solution hoping that it might improve the performance.
Kindly let me know how to use the sumproduct formula in VBA.
My cell formula is as below.

=SUMPRODUCT(-(ALVXXL01!$B$2:$B$65536=A5),-(ALVXXL01!$K$2:$K$65536="MMV3"),(ALVXXL01!$P$2:$P$ 655360),ALVXXL01!$P$2:$P$65536)

If there is any better alternative, kindly let me know.

Thanks,
Madiya



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default How to use SUMPRODUCT in VBA

Do mean something like:

I changed the A5 to A & r in the first part of the formula - I don't know if
this is correct. You can put similar formulas to the other columns but change
MMV3 to MDA1 and the "" to "<"

For r = 2 to 100

Range("d" & r) =
Evaluate("SUMPRODUCT(--(ALVXXL01!$B$2:$B$65536=A" & r
&"),--(ALVXXL01!$K$2:$K$65536=""MMV3""),--(ALVXXL01!$P$2:$P$655360),--(ALVXXL01!$P$2:$P$65536))")

Next r

HTH

"Madiya" wrote:

Thanks for your reply. It works great.
But this works only for one cell i.e. static. I need to have a dynamic
formula.
Let me explain.
I have 22 cloumns (fixed) in my data sheet. 2nd col is having mat codes
(may repeat in subsequent rows)
No of rows is variable but above 5000.


I have extracted and listed unique mat codes from data sheet to this
summary sheet in col A.
There are 4 variables (<0, 0, MMV3, MDA1)
I need to use this formula against each unique mat code in a new sheet
called Summary.
Col C is with MMV3 and <0
Col D is with MMV3 and 0
Col E is with MDA1 and <0
Col F is with MDA1 and 0

I can use vlookup or other regular formula in VBA but SUMPRODUCT is not
woking dynamic.

How can I do it?

Regards,
Madiya


Toppers wrote:
Range("d1") =
Evaluate("SUMPRODUCT(--(ALVXXL01!$B$2:$B$65536=A5),--(ALVXXL01!$K$2:$K$65536=""MMV3""),--(ALVXXL01!$P$2:$P$655360),--(ALVXXL01!$P$2:$P$65536))")


"Madiya" wrote:

Hi,
I have a large sheets containing 4700 rows of data with more the 700
unique code numbers.
I tried to use pivot table to get summary but it has limitations due to
which many code numbers are not displayed in the pivot tables.

Then, I tried to use sumproduct formula in cells but due to large
numbers of fumproduct formula, sheet became very slow.

So now I was trying to acheive the same results as of pivot table thru
VBA solution hoping that it might improve the performance.
Kindly let me know how to use the sumproduct formula in VBA.
My cell formula is as below.

=SUMPRODUCT(-(ALVXXL01!$B$2:$B$65536=A5),-(ALVXXL01!$K$2:$K$65536="MMV3"),(ALVXXL01!$P$2:$P$ 655360),ALVXXL01!$P$2:$P$65536)

If there is any better alternative, kindly let me know.

Thanks,
Madiya




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
Sumproduct with Condition OR Sumproduct with ADDRESS function - HE gholly Excel Discussion (Misc queries) 2 September 28th 09 05:07 PM
Conditional SUMPRODUCT or SUMPRODUCT with Filters Ted M H Excel Worksheet Functions 4 August 14th 08 07:50 PM
sumproduct? sumif(sumproduct)? David Excel Worksheet Functions 3 July 13th 07 07:06 PM
need sumproduct driller2 Excel Discussion (Misc queries) 5 December 21st 06 04:14 PM
sumproduct Mandy Excel Discussion (Misc queries) 3 February 8th 06 01:25 PM


All times are GMT +1. The time now is 02:10 AM.

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"