# 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....

## Can SUMPRODUCT Be Used When Only Two Ranges Are Specified

Aug 7, 2007

I can't get the following formula to work...

SUMPRODUCT((Range1Range2)*(DollarValue))

Basically I have a master sheet of data:

Range1 DollarValue
AAA 20
BBB 35
CCC 5
DDD 10

and a separate sheet with items i want excluded from the calc:

Range2
BBB
DDD

I want the SUMPRODUCT to give me a value of 25 (AAA + CCC, excluding BBB and DDD from the calc). However, I'm getting #N/A in my formula cell. Is there an easy way to do this other than specifying each value to exclude, e.g. SUMPRODUCT((Range1"BBB")*(Range1"DDD")*(DollarValue))

I have a lot of values to exclude, so this could get very hard to manage...

## SUMPRODUCT Using Named Ranges

Mar 27, 2014

I am using the SUMPRODUCT formula below and it seems to be working

=SUMPRODUCT(('Attendance Data'!H:H="XXX")*('Attendance Data'!D:D="YYY"))

This, as I understand it is counting the number of times a row contains the text "XXX" in column H and also contains the text "YYY" in column D.

This seems to work for me.

Now my problem is when I want to change the formula to search for the text "XXX" in column H and also any text that apperas in a named range on another sheet in column D. The named range is called "New_Starters"

I am using the below formula which is returning N/A's.

=SUMPRODUCT(('Attendance Data'!D:D=New_Starters)*('Attendance Data'!H:H="XXX"))

## #Value! Error When Doing Sumproduct Of Two Ranges

Oct 2, 2007

I have a weird problem with some cells calculating (for example) =sumproduct(bundleNoNRP, bundleNoQTY). There are a number of cells with similar formulas calcutating with named ranges, and they all display #Value (a value of the wrong data type is used in this formula).

Both these ranges are set up via a VB program.
If i just seperately on the sheet do the sum of either of these ranges it works fine.

What could be going wrong? Is there some way of checking whats in the ranges? I cant see why the data type would be wrong if I can do sum calcs ok..Is there some rule which would mean the calculation wouldn't work anymore? This is part of a much larger VBA project so I hope I have provided enough information.

## Dynamic Ranges And Sumproduct

May 2, 2007

I'm having a fit with this formula; maybe the gurus will show me what I'm doing wrong. I have a list of area numbers along with dollar amounts that go with these area numbers. I have created a named range named "Areas" and another one named "MO_PD".

At the bottom of the worksheet I am doing a recap that takes the area number and sums all the entries in the MO PD column. This approach has been done before with Thomach's help. I'm trying to mimic it, but it's not working for me.

NOTE - I know that I can get around this using a pivot table, but I would like to use this approach for now. I would at least like to know what I'm doing wrong. Also, I'm not totally sure if I did the dynamic named ranges correctly so that may need to be fixed.

## Using Multiple Sum Ranges In Sumproduct() & Countif() In Array

Jul 2, 2009

My problem is :

1.In G Column I put logic for Fail and Obtained Marks.

G2=IF(COUNTIF(B2:F2,">=60")=5,SUM(B2:F2),"Fail")

2. Now in H column I want use this formula which I obtained from this forum

H2=SUMPRODUCT((G\$2:G\$7>G2)/COUNTIF(G\$2:G\$7,G\$2:G\$7&""))+1

To get the position of Students.

But the text value "fail" in the G2:G7 getting Position No. 1 and i've noticed the reason by using evaluate formula as well.

3. I got solution by changing "Fail" with 0 by creating column I and then column H put this formula ........

## Using Multipel Sum Ranges In Sumproduct() & Countif In Array

Jul 6, 2009

I want to get students positions in a class like 1st, 2nd, 3rd, etc. There can be two 1st position and 2 2nd positions at a time .

1.In G Column I put logic for Fail and Obtained Marks.
G2=IF(COUNTIF(B2:F2,">=60")=5,SUM(B2:F2),"Fail")
2. Then i made array formula in column H to get the position
={SUMPRODUCT((IF(ISNUMBER(\$G\$2:\$G\$7),\$G\$2:\$G\$7,0)>N(G2))/COUNTIF(G\$2:G\$7,G\$2:G\$7&""))+1}
Some improvement to write fail & position
={IF(COUNTIF(B3:F3,">=60")5,"Fail",SUMPRODUCT((IF(ISNUMBER(\$G\$2:\$G\$7),\$G\$2:\$G\$7,0)>N(G3))/COUNTIF(G\$2:G\$7,G\$2:G\$7&""))+1)}
And more work to get total marks & position and Fail at the same time......
={IF(COUNTIF(B2:F2,">=60")5,"Fail",SUM(B2:F2)&"-"&SUMPRODUCT((IF(ISNUMBER(\$G\$2:\$G\$7),\$G\$2:\$G\$7,0)>N(G2))/COUNTIF(G\$2:G\$7,G\$2:G\$7&""))+1)}
Now I wounder that is there a way to do all calculations in column H without using column G

By replacing (if there is any method) G2, G3, G4 etc. with Sum(B2:F2); Sum(B3:F3);Sum(B4:F4) etc. in below formula
={SUMPRODUCT((IF(ISNUMBER(\$G\$2:\$G\$7),\$G\$2:\$G\$7,0)>N(G2))/COUNTIF(G\$2:G\$7,G\$2:G\$7&""))+1}.....................

## Complex COUNTIFS / SUMPRODUCT Validating Dates Using 2 Ranges

Oct 4, 2013

I am trying to find out how many projects might be active as of a certain date.

I have a tab in excel that contains project data. For each project there is a "Start Date" and there might be an "End Date"

My question is, how do I count all the rows where the start date is Less than a given date and the end date is after a given date? The wrinkle is... if the end date is empty then obviously it should be counted as well (assuming the start date is still before the given date).

Here are the approaches I've used thus far:

=SUMPRODUCT(1*( AND(OR(RawMetrics!P:P > A2, RawMetrics!P:P = ""), RawMetrics!\$O:\$O < A2 )))
=COUNTIFS(RawMetrics!P:P,">"&Sheet1!A2,RawMetrics!O:O,"

## Excel 2010 :: Sumproduct Of Unique Values In Multiple Ranges

Jul 31, 2014

I have 3 ranges of data which each have a quantity and a length. I want to create from these ranges a list of unique values with the total quantity required of each value (as shown). Inputs on any column may be blank but where there is a length, there will be an adjacent quantity to the left.

I'm using Excel 2010.

## Move Ranges To Corresponding Ranges Based On Column Having Data

Oct 25, 2007

I need help creating a macro that will search through my excel spreadsheet and for every instance where column A isn't empty it should cut a range of columns from that row and paste them in a different range of columns in the row before it. It should then delete the row that it cut the columns from and keep searching until it has done this for the whole worksheet. I can modify which range of columns are needed, but it has been so long since I've worked with excel macros that I haven't been able to do it.

## Static Ranges And Dynamic Ranges

Feb 26, 2010

definitions for static ranges and dynamic ranges?

## 2 Input Vertical Ranges Need Formulas To Output 2 Vertical Summary Ranges

Mar 7, 2013

I have two vertical ranges that I need summarized into 2 adjacent vertical ranges.

"
A B C D
| SUMMARY
model qty| modelqty
1 4.12922.0000| 4.12952.2000
2 2.000012.1250| 2.000025.1250
3 4.12929.0000| 318.0000
4 318.0000|
5 4.1291.2000|
6 213.0000|
"

A1:A6 is my SKU's model number B1:B6 is my inventory C1:C6 should contain formulas that result in a summary of the models D1:D6 should contain formulas that result in a sum of the inventory count for each model

## Copy Ranges & Add Them To Other Ranges

Nov 1, 2006

In the attached file, I have variable range in column A:B, column C:D and in column E:F

I want a macro to do the following:

Start with sheet "A", select the available range in column A
then copy and paste in the sheet "B" but with all the cell values added with the value in H1.

Then in sheet A, simply copy the available range in column B and paste it in sheet B

Do the same until column F in sheet A. Pastespecial if it is odd column. simple past it is even column.

I know the macro code for the simple paste. But I am struggling with the paste special code.

## Define Only 2 Named Ranges From List Of Named Ranges

Apr 28, 2014

I have written this macro to convert into a csv file to run for all defined named ranges in the activesheet. It run jst perfect when I hit SAVE button and it creates that many different CSV files for each named range.

However I am trying to use same macro in the another file and the problem I am facing is there a lot more named ranges and I want to run the macro for only selected NAMED RANGE. In this case 2 Named Range / 24 Named range.

What part of code do I need to change and to what to make it work for just 2 named ranges ?

## 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 ?

## Sumproduct..?

Jul 11, 2009

I have the following formula:

## 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.....

## 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

## 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?

## 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")))

## 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.

## 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.....

## 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.............................

## 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

## 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???

## 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

## 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.

## 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

## 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.

## 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.