Sumproduct In A Macro

Jul 3, 2007

I'm having problems with sumproduct in a macro.

Here is an example of the

Sub Macro2()

Set ListB = Sheets("Sheet1").Range("B4:B22000")
Set ListC = Sheets("Sheet1").Range("C4:C22000")
Set ListD = Sheets("Sheet1").Range("D4:D22000")


MsgBox Evaluate("=SumProduct(--(" & ListB.Address & " = B4),--(" & ListD.Address & " = E1 ))")
'The above returns zero, which is not correct

Var1 = Range("B4").Value
Var2 = Range("E1").Value
MsgBox Evaluate("=sumproduct(--(" & ListB.Address & " = Var1), --(" & ListD.Address & " = Var2))")
' The above results in a Run Time 13 Type Mismatch error
End Sub

View 9 Replies


ADVERTISEMENT

Use Sumproduct Formula In Macro

Oct 18, 2008

Is there anyone know how to Use sumproduct formula in macro?

View 9 Replies View Related

Add SUMPRODUCT To Cell With Macro

Aug 14, 2007

I am trying to use the sumproduct function with ranges defined in my VBA code. I can’t seem to get it to work.

I have two spreadsheets in the enclosed work book – T1, T2

T2 has four columns with the first three columns are text and the fourth column is an integer. The rows in this sheet may be repeated.

T1 has four columns similar to the first three columns in T2. However, the rows are unique. I am trying to do a sumproduct for obtaining the counts on the fourth column in sheet T1

To obtain the values for the fourth column (for each row) in T1 I do the following ...

View 4 Replies View Related

SUMPRODUCT Macro With Multiple IF Statements

Feb 9, 2008

I'm needing a macro that will allow me to get around the limits of no more than 7 IF statements and using a SUMPRODUCT formula as well. I need the total or sum of the macro/formula to be in cell "DB8".

Here's my formula: =SUMPRODUCT(IF(CP8=M11,EXACT(K7,"DI"),0)+0+SUMPRODUCT(IF(CP8=W11,EXACT(U7,"DI"),0)+0+SUMPRODUCT(IF(CP8=AG11,EXACT(AE7,"DI"),0)+0+SUMPRODUCT(IF(CP8=AQ11,EXACT(AO7,"DI"),0)+0+SUMPRODUCT(IF(CP8=BA11,EXACT(AY7,"DI"),0)+0+SUMPRODUCT(IF(CP8=BK11,EXACT(BI7,"DI"),0)+0+SUMPRODUCT(IF(CP8=BU11,EXACT(BS7,"DI"),0)+0+SUMPRODUCT(IF(CP8=CE11,EXACT(CC7,"DI"),0)+0+SUMPRODUCT(IF(CP8=CO11,EXACT(CM7,"DI")+0,0))))))))))

View 9 Replies View Related

Convert Sumproduct Formula To Macro

Oct 31, 2006

The attached has a sumproduct formula that is slow down the calculation of my workbook. (I know there is also an array formula-that's another thread). I'd like to use a macro to fire on the worksheet change so I don't have the heavy recalc burden. The formula is in worksheet "Database" in column H. So far:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range(Range("rReason").Offset(1, 0), Range("rReason"). _
Offset(UsedRange.Rows.Count + 1, 0))) Is Nothing Then
Target.Offset(0, 1) = Application.VLookup(Target, ValList.Range("ReasonLkUp"), 2, False)
'This formula below needs a VBA equivalent
' Target.Offset(0, 2).FormulaR1C1 = "=IF(RC[-1]>0,SUMPRODUCT(-(R7C7:R35000C7<0)*0.5,--(R7C3:R35000C3=RC[-5]))+SUMPRODUCT(--(R7C7:RC7>0),--(R7C3:RC3=RC[-5]),R7C7:RC7),0)"
End If
If Not Intersect(Target, Range(Range("rSurname").Offset(1, 0), Range("rSurname"). _
Offset(UsedRange.Rows.Count + 1, 0))) Is Nothing Then
Target.Offset(0, 1) = ActiveCell.Offset(0, -2) & " " & ActiveCell.Offset(0, -1)
End If
End Sub

View 5 Replies View Related

Sumproduct Macro: Check One Coloumn For Negative Numbers And Another For A Date

Jun 30, 2009

I have a problem with a sumproduct formula which check one coloumn for negative numbers and another for a date so that it count all cases of negative numbers in a month i choose. (S contains numbers and AH contains dates)....

When i use it in a makro i get a "type mismatch" when i run the macro. I wonder if anyone can see where my syntaks is incorrect? Here is how it looks in the macro:.....

View 4 Replies View Related

Macro To Compare 2 Lists Based On Multiple Criteria Using SUMPRODUCT?

Feb 27, 2014

I want to compare 2 lists in separate sheets based on multiple criteria and delete the duplicates

Sheet 1 - new list in column A:E
Sheet 2 - old list in columns B:F

So here is what I need: the macro should generate single IDs made of Sheet 1 Ai,Bi,Ci,Di,Ei cells for each row i to the end of the list + generate single IDs made of Sheet 2 Bi,Ci,Di,Fi

If . Evaluate (Sumproduct (IDs made of Ai,Bi,Ci,Di,Ei from sheet1) & Sumproduct IDs made of Bi,Ci,Di,Ei,Fi from sheet2) >1 then delete the entire row in Sheet 2.

This will leave me with only updated items (rows) in Sheet 2

View 1 Replies View Related

Sum & Sumproduct

Dec 18, 2008

I have the following formula's:

SUMPRODUCT(($O$9:$O$259="Active")+0)+SUMPRODUCT(($O$9:$O$259="Clearing Tmrw")+0) and

SUMPRODUCT(--($O$9:$O$259="Active"),$B$9:$B$259)+SUMPRODUCT(--($O$9:$O$259="Clearing Tmrw"),$B$9:$B$259) and

SUMPRODUCT(--(YEAR($A$9:$A$259)=$E$4)*($O$9:$O$259="Active"),$B$9:$B$259)+SUMPRODUCT(--(YEAR($A$9:$A$259)=$E$4)*($O$9:$O$259="Clearing Tmrw"),$B$9:$B$259)

My spreadsheet A1 to Q7 are where the headers and above formula's are and row 8 is hidden and has other formula's in (col C,M,N,O,P & Q)

The User then clicks the insert row macro which inserts a blank row (with row 8 formaules) into row 9.

However, the above formula's then change from 9 to 10 therefore, not picking up all the amounts.

Can anyone help me so that the formulas continue from row 9 ?

View 10 Replies View Related

Sumproduct..?

Jul 11, 2009

I have the following formula:

View 4 Replies View Related

SUMPRODUCT = #Value!

Mar 25, 2009

I have a spreadsheet in which I am using SUMPRODUCT. As you can see from the attachment, on the "Breakout by PIpeline" tab, Columns C, D & F are working perfect. However, Column B & E are duplicates of C & D - just wanting to pull the volume from the "Detail" tab instead of the dollars...and I keep getting the #VALUE! error.

I have tried formatting the Volume column differently - and even multipling the data times -1 and then pasting back in.....

View 3 Replies View Related

How To Add Another Sum To Sumproduct

Jul 11, 2012

How to add another sum to this formula?

this is the formula i have at the moment

=SUMPRODUCT(--($AA$21:$AA$6376

View 4 Replies View Related

Using SumProduct

Dec 4, 2007

Here's my question.
jan- feb- mar- apr- may
rep a 1 1 2 5 1
rep b 1 2 7 7 7
rep c 5 5 1 2 2
rep d 1 1 1 1 1
rep e 2 2 2 2 2
rep f 1 2 3 4 5
rep g 0 0 0 7 9

date date
March May

How do I set it up so that I will have two cells that will contain a month. Once the 2 months are selected it will give me the total for each rep during that time period? Do I use sumproduct?

View 9 Replies View Related

SUMPRODUCT #NAME

Aug 12, 2008

I have a report with a macro that imports a .TXT file into Excel then calculates the follwing formula. For some reason, before the .TXT file is loaded the formula is fine and has no errors, then when it is run I get a "#NAME?" error. I thought it might be because the formula changed during the macro but that's not it. Examples are below.

I've looked online and tried naming the ranges, but that doesn't work. I've tried the built in help but that didn't help. I've tried making sure the analysis pak is installed but that's not it either.

I've ran out of ideas now and you guys are my last hope. Any clues...??

Before macro:
=SUM(SUMPRODUCT(--(DelDate>=6),--(Branch=$B3),--(Status"DEAL"))-SUMPRODUCT(--(DelDate>=6),--(Branch=$B3),--(Status="AWAI")))

After macro:
=SUM(SUMPRODUCT(--(DelDate>=6),--(Branch=$B3),--(Status"DEAL"))-SUMPRODUCT(--(DelDate>=6),--(Branch=$B3),--(Status="AWAI")))

View 9 Replies View Related

SUMPRODUCT Using OR

Aug 13, 2008

=SUMPRODUCT(OR(MIS!$T$4:$T$2042>500000)*(MIS!$U$4:$U$2042>500000))*(MIS!$Z$4:$Z$2042=C2)

it is if the cell in Column T >500,000 or the cell in Column U is more than 500,000. I keep getting a value error and I can't find a way around it.

View 9 Replies View Related

Sumproduct With Min/Max ...

Aug 26, 2008

I'm working on a project on predicting future cash flows from loans we have made and have ran into a wall as i can't figure out the formula to achieve what i would like to do. I've gotten a lot of help from you guys in the past and would appreciate any help you may be able to provide for this problem. So here it goes. First, here is how i have the spreadsheet setup.....

View 9 Replies View Related

Sumproduct In VBA Getting #Value

Nov 12, 2008

I've got a spreadsheet that had _many_ sumproducts and calls to vba functions and when it recalculated took some time to finish, so I thought I'd group the vba function with the sumproduct to see if it was faster, but I keep getting a #Value! error. The sumproduct layout worked fine on the actual spreadsheet, so I'm sure something is lost in translation. Here is my
Function weight(Aref As Range, count As Integer, Bref As Range) As Variant

Dim i As Integer
Dim top As Integer
Dim vA() As Variant
Dim cA() As Variant
Dim vR As Range
Dim cR As Range

Dim count As Integer

count = Widgets.Rows.count

ReDim vA(count - 1)
ReDim cA(count - 1)


top = Aref.Rows.count

For i = 0 To top - 1.............................

View 9 Replies View Related

Sumproduct :: Get Sum Of 0

Apr 29, 2009

I seem to get a sum of 0 when I use this sumproduct syntax: SUMPRODUCT(($R$77:$R$442="H")*($Q$77:$Q$442="OTE"),(D77:D442)). What am I not doing?

Below is an e.g. of my data

CDEFGHIJKLMNOPQRAdmin4444440 ...

View 9 Replies View Related

SUMPRODUCT Getting #Value

Jul 27, 2009

=-SUMPRODUCT((Catagory=$A26)*(MONTH(Paid_Date)=12)*
(YEAR(Paid_Date)=12)*(How="Till")*(How="Banking")*(Expenses))

This problem is I keep getting a #Value! error when I place the date section into formula. I have check to see thatthe date format is correct and as far as I can tell it is EXAMPLE: 06/12/2007

This formula did work in a nother worksheet, thus the confusion Ihave

The other issue is how to get two different text items in the "HOW" group to be True for Formula to pull requested values???

View 9 Replies View Related

Sumproduct In VBA

Apr 30, 2003

Now I am trying to build a user-defined function to use it.
It works in EXCEL but I can't get it to work in VBA


Function xxx(x,y)
Dim a, b, c As Range
a = Range("a4:a14") ' contains text
b = Range("b4:b14") ' contains text
c = Range("c4:c14") ' contains values
Range("a20") = Application.SumProduct((a = x) * (b = y) * c)
End Function

View 9 Replies View Related

If And Or Sumproduct

Jun 27, 2006

If B97:158=GL AND C97:C158=0001 THEN SUM E97:E158 OTHERWISE "0.00". I can't figure out the best formula to use.

View 2 Replies View Related

Sumproduct And Vba

Jun 12, 2007

sum with criteria. The solution was: = SUMPRODUCT(($A$7:$A$41=$A45)*($E$7:$E$41))

That was great, but, i need this every week, for a report, and not always all are in the same cells, and this formula is into a code, so the code loses sense when the week change. I tried to change the formula into a code, but it's impossible for me, although i have read all the post about it and sumproduct vba code. So, every week i use the same ranges in my code. So, for example:

A7:A41 in my code is:

Range(cells(7,1), cells(LastCell,1)

because i don't finish every week in the same row of column A

A45 is

Cells(LastCell + 4, 1)

I attach the same sheet of the other day

View 8 Replies View Related

Sumproduct Given A Condition?

Apr 7, 2014

I am trying to arrive at the results in the yellow cells without needing the blue cells inbetween.

A sumproduct would be best but the 2nd row of blue cells has an if statement in it.

View 3 Replies View Related

Sumproduct With Hours

Jan 19, 2014

I am trying to do a sumproduct formula with hours and it is not calculating right.

Here is my current formula:

=SUMPRODUCT(([Productivity.xlsx]Occupancy!$A$2:$A$5000>=$C$1)*([Productivity.xlsx]Occupancy!$A$2:$A$5000<=$C$2)*([Productivity.xlsx]Occupancy!$B$2:$B$50ry00=$A4)*([Productivity.xlsx]Occupancy!$C$2:$C$5000))

My values in Column C that I am trying to get the sum of are:

1:24:49
:59:08
:58:46
1:39:19
1:10:08
1:13:15
1:04:23
1:43:04
1:23:55
1:48:11
1:42:41

The result of the sumproduct I am currently getting is 7824:00:00, however when I select the above values, Excel is showing it should be 13:09:45 in the status bar, which seems accurate.

I am not sure what I am missing to get this same number.

View 6 Replies View Related

SUMPRODUCT Using A Condition

Jun 20, 2014

I would like to create a formula in D7 that calculates the weighted average growth for products (column A) manufactured by Bob (column B). In J5 I've inserted the expected result using a SUMPRODUCT function.

How to create a formula in D7 that will calculate from the data in B6:D6 the same result as in J5. i.e. How do I make the SUMPRODUCT function only consider data in columns C and D when Bob is the manufacturer?

View 2 Replies View Related

Sumproduct Problems With #N/A

Jan 24, 2007

I am using SUMPRODUCT to check if the word "Yes" appears in two colums andcount the number of occurances.

Many of the cells in the range evaluate to error #N/A - this is unavoidable.

As a result, SUMPRODUCT in the formula

=SUMPRODUCT(--(H12:H486)="yes")*(--(Q12:Q486)="yes") evaluates to #Value.

I have tried to error trap this using

=SUMPRODUCT(--(ISTEXT(G12:G486)="yes"))*(--(ISTEXT(P12:P486)="yes"))

But this evaluates to #N/A.

View 12 Replies View Related

Sumproduct Function

Nov 23, 2007

In this file I have a team in column A, in B are the relative number of games they have played, and in C the filed goal % for them in that game. The value I am trying to return the average field goal % for that team in there last 10 games. I thought the sumproduct would work but is not returning a value,

View 11 Replies View Related

Sumproduct - Three Variables

Feb 19, 2008

I am trying to add an additional criteria to the following sumproduct formula. The formula below works fine to add up values that are within a date range. However, I want to add values within a specified date range as well as one additional variable. The additional variable is in column G.

SUMPRODUCT(--($A$3:$A$1015>=$A1026),--($A$3:$A$1015<=$B1026),D$3:D$1015)

View 10 Replies View Related

Sumproduct With Different Ranges

Nov 5, 2008

I'm attempting to do a sumproduct with different dimensioned ranges. I've read multiple posts that say that all ranges in a sumproduct must have the same dimensions. I've tried different commands (index/match/lookup, etc) with no luck. Perhaps someone can come up with a solution for me....

View 7 Replies View Related

Sumproduct Is Not Working

Mar 4, 2009

=((SUMPRODUCT((('Data Sheet'!$A$2:$A$997<2110000)+('Data Sheet'!$A$2:$A$997>2119999)),--(ISNUMBER(MATCH('Data Sheet'!$B$2:$B$997,{300100,302100},0))),('Data Sheet'!E$2:E$997*IF('Data Sheet'!E1<=$F$4:$G$4,1,0))

The last part of the formula is the problem, the first two arrays are conditions and the last array is a sum if f4 a period of the year is equal or less to the data sheet tab it is summing.The formula below works fine, but when the last condition is added it doesn't work.

=((SUMPRODUCT((('Data Sheet'!$A$2:$A$997<2110000)+('Data Sheet'!$A$2:$A$997>2119999)),--(ISNUMBER(MATCH('Data Sheet'!$B$2:$B$997,{300100,302100},0))),'Data Sheet'!E$2:E$997)

View 7 Replies View Related

Sumproduct - Addition By Name

Jun 11, 2009

I need to C8 - C19 only to add up jobs won by andrew (in current orders). It needs to be month specific. what i mean by that is I need the formula to do what its doing now (adding up the jobs by and putting the totals into the according cell depending on what month they were won.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved