Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Is there a macro equivalent to cell function SumProduct?


I have an Excel 2003 spreadsheet with the following cell formula:

SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(Base!$L$5:$L $10000="COST")*(Base!$I$5:$I$10000))

The column of $S11 is about 500 rows.

I have an aversion to cell formulas and would like to carry out this
computation with a Macro. Is there an existing macro routine that does this
same type of calculation?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Is there a macro equivalent to cell function SumProduct?

use a UDF (User Defined Function)

eg


Option Explicit

Function MySumProduct()

MySumProduct =
Evaluate("=SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(B ase!$L$5:$L$10000=""COST"")*(Base!$I$5:$I$10000))" )

End Function

in your sheet, select a cell and type
=MySumProduct()





"MavenDog" wrote:


I have an Excel 2003 spreadsheet with the following cell formula:

SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(Base!$L$5:$L $10000="COST")*(Base!$I$5:$I$10000))

The column of $S11 is about 500 rows.

I have an aversion to cell formulas and would like to carry out this
computation with a Macro. Is there an existing macro routine that does this
same type of calculation?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Is there a macro equivalent to cell function SumProduct?


Patrick,

Thank you so much. I tried it, and it worked fine. I had never heard of
the 'evaluate' method. I appreciate your taking the time to help me. I
would never have gotten past the need for the double quote even if I had
known about 'evaluate'.

Do you have a favorite reference book that includes more detailed
programming information than the Visual Basic manual that came with my Office
2003?

Jim (aka Mavendog)

"Patrick Molloy" wrote:

use a UDF (User Defined Function)

eg


Option Explicit

Function MySumProduct()

MySumProduct =
Evaluate("=SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(B ase!$L$5:$L$10000=""COST"")*(Base!$I$5:$I$10000))" )

End Function

in your sheet, select a cell and type
=MySumProduct()





"MavenDog" wrote:


I have an Excel 2003 spreadsheet with the following cell formula:

SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(Base!$L$5:$L $10000="COST")*(Base!$I$5:$I$10000))

The column of $S11 is about 500 rows.

I have an aversion to cell formulas and would like to carry out this
computation with a Macro. Is there an existing macro routine that does this
same type of calculation?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Is there a macro equivalent to cell function SumProduct?

SUMPRODUCT((Data!$N$5:$N$10000=$S11)*...
Is there an existing macro routine that does this..


Hi. Just to give another idea:

Sub Demo()
Dim x
With WorksheetFunction
x = .SumIfs([Base!I5:I20], [Data!N5:N20], [S11], [Base!L5:L20], "Cost")
End With
End Sub

Although 'Sumproduct' is the most popular, sometimes I find the above
reads a little easier (in some cases).

= = = = =
Dana DeLouis


On 2/10/2010 8:51 PM, TexPop wrote:

Patrick,

Thank you so much. I tried it, and it worked fine. I had never heard of
the 'evaluate' method. I appreciate your taking the time to help me. I
would never have gotten past the need for the double quote even if I had
known about 'evaluate'.

Do you have a favorite reference book that includes more detailed
programming information than the Visual Basic manual that came with my Office
2003?

Jim (aka Mavendog)

"Patrick Molloy" wrote:

use a UDF (User Defined Function)

eg


Option Explicit

Function MySumProduct()

MySumProduct =
Evaluate("=SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(B ase!$L$5:$L$10000=""COST"")*(Base!$I$5:$I$10000))" )

End Function

in your sheet, select a cell and type
=MySumProduct()





"MavenDog" wrote:


I have an Excel 2003 spreadsheet with the following cell formula:

SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(Base!$L$5:$L $10000="COST")*(Base!$I$5:$I$10000))

The column of $S11 is about 500 rows.

I have an aversion to cell formulas and would like to carry out this
computation with a Macro. Is there an existing macro routine that does this
same type of calculation?



--
= = = = = = =
HTH :)
Dana DeLouis
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Is there a macro equivalent to cell function SumProduct?

Thank you Dana for your suggestion. I appreciate your response. I am
beginning to think I should move to a relational data base system considering
the size of my data bases. It takes forever to compute in Excel.

Jim

"Dana DeLouis" wrote:

SUMPRODUCT((Data!$N$5:$N$10000=$S11)*...
Is there an existing macro routine that does this..


Hi. Just to give another idea:

Sub Demo()
Dim x
With WorksheetFunction
x = .SumIfs([Base!I5:I20], [Data!N5:N20], [S11], [Base!L5:L20], "Cost")
End With
End Sub

Although 'Sumproduct' is the most popular, sometimes I find the above
reads a little easier (in some cases).

= = = = =
Dana DeLouis


On 2/10/2010 8:51 PM, TexPop wrote:

Patrick,

Thank you so much. I tried it, and it worked fine. I had never heard of
the 'evaluate' method. I appreciate your taking the time to help me. I
would never have gotten past the need for the double quote even if I had
known about 'evaluate'.

Do you have a favorite reference book that includes more detailed
programming information than the Visual Basic manual that came with my Office
2003?

Jim (aka Mavendog)

"Patrick Molloy" wrote:

use a UDF (User Defined Function)

eg


Option Explicit

Function MySumProduct()

MySumProduct =
Evaluate("=SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(B ase!$L$5:$L$10000=""COST"")*(Base!$I$5:$I$10000))" )

End Function

in your sheet, select a cell and type
=MySumProduct()





"MavenDog" wrote:


I have an Excel 2003 spreadsheet with the following cell formula:

SUMPRODUCT((Data!$N$5:$N$10000=$S11)*(Base!$L$5:$L $10000="COST")*(Base!$I$5:$I$10000))

The column of $S11 is about 500 rows.

I have an aversion to cell formulas and would like to carry out this
computation with a Macro. Is there an existing macro routine that does this
same type of calculation?



--
= = = = = = =
HTH :)
Dana DeLouis
.



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
equivalent for function , please for help ytayta555 Excel Worksheet Functions 5 April 21st 08 02:03 AM
Is there an equivalent of sumproduct but for count? PGarcia Excel Discussion (Misc queries) 6 November 26th 07 07:16 PM
WORKDAY() Function Equivalent with SUMPRODUCT() George Ray Excel Worksheet Functions 4 October 9th 06 04:04 PM
What is the Excel equivalent of the CELL function? JP Excel Worksheet Functions 8 September 5th 06 12:49 AM
VBA equivalent for SQL 'IN' function Mitch Excel Programming 4 February 1st 06 11:09 PM


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