# Sumproduct OR Adding Criteria To Countif, Counta And Average

Feb 21, 2010

I trying to convert the following formula (I, II, III) and add criteria of Name and Date to the count values of “c”

CURRENT FORMULA

I: “=COUNTIF(C2:C3100,"

## Adding Another Condition To Sumproduct (countif) Statement

Oct 6, 2011

I am using the formula below to count the occurences of relevant text strings (names) in a cell that can contain many separate strings. It works great. "References!\$F\$2:\$F\$34" contains my list of names and the formula returns how many occurences there are in each cell.

What i'd like to do know is work in a date criteria. Each name has an associated relevant date attached to it as does each cell that I am looking for these names in.

So...in english what Id like to do is alter my formula so that when it finds a text string that exists in "References!\$F\$2:\$F\$34", it then compares the associated date in "References!\$G\$2:\$G\$34" with the date associated with N3 which happens to be O3.

SUMPRODUCT(COUNTIF(N3,"*"&References!\$F\$2:\$F\$34&"*"))

## Multiple Criteria Countif Or Sumproduct

Sep 16, 2009

I haven't been this deep into excel before. The deeper I look, the more potential I recognize, the more amazed I get. That being said, I have come to a tough count issue. Let me attempt to explain as precisely as possible.

My current worksheet is large but I am only particularly concerned with two columns of information (Regions) and (Days). The logic I am attempting is something along the lines of Count If Region = East, or West, and Days is greater than 0, less than 60.

I am open to any and all suggestions on how to tackle this situation. I have been able to achieve similar counts by using pivot tables but the dynamic nature of these two columns presents some difficulties that my “new user” mind has been unable to work through.

## 2003: COUNTIF/SUMPRODUCT, Multiple Criteria W/Wildcard

Nov 24, 2008

I'm trying to write this but it returns a 0 when I know there are 3 records that match this criteria: =SUMPRODUCT(('Invoice-Detail'!J2:J50="NewJob_Post.NET")*('Invoice-Detail'!H2:H50="KY_*")). I think the problem is in the wildcard character. I don't know if I should be using COUNTIF or SUMPRODUCT or something else?

## Adding Third Criteria To Sumproduct Function

Feb 5, 2014

=IF(LEN(A480),SUMPRODUCT((RIGHT(Sold!\$D\$15:\$D\$8998,LEN(A480))=A480)*(MONTH(Sold!\$M\$15:\$M\$8998)=12)),"")

I would like to edit the function above and add a third criteria. If Sold!S:S,"Returns" to my sumproduct.

I tried to edit it myself with the function below but it didn't work.

=IF(LEN(A480),SUMPRODUCT((RIGHT(Sold!\$D\$15:\$D\$8998,LEN(A480))=A480,Sold!S:S,"Returns")*(MONTH(Sold!\$M\$15:\$M\$8998)=12)),"")

## Combining 'counta' And 'countif'

Oct 1, 2008

I'm trying to create a report to show daily statistics for internet traffic. I have a large table showing a daily breakdown of performance, a table showing combined cost for all "Mondays", "Tuesdays" etc in the month and I also want a table to show the "average" performance for a typical "Monday", "Tuesday" etc.

The report will be used on a daily basis and I realised that until there is a full compliment of data the daily averages table would be inaccurate as it will be dividing the overall total for each day by the total number of occurances each day has in a typical month. This is wrong because if we are only halfway through the month then we will be dividing by days that haven't arrived yet.

## Possible To Use COUNTIF And COUNTA In Same Formula

Jan 30, 2013

I am using the following formula to calculate the number of responses:

=COUNTIF([Cleanliness of Environment:],"None of the above")

However, I only want the number of cells which contain words other than "None of the above". The formula is counting empty cells. Is there a way to weed out the empty cells and receive a tally of only cells with words other than "None of the above" in them?

## Counta With A Tweak - Countif(?*)

Jul 5, 2007

How do I count the number of cells in a range that has text, even though all cells has a link....

## Countif Function In A Macro: SUM And COUNTA Works

Jan 27, 2009

I'm using the SUM, COUNTA and COUNTIF functions in a macro. The SUM and COUNTA works but the COUNTIF function does not return results.

Sub B_Test()
Dim myRange
Dim Results
Dim Run As Long
myRange = Workbooks(1).Worksheets("Master").Range("S6", Range("S6").End(xlDown))
Range("M3") = Application.WorksheetFunction.Sum(myRange)
myRange = Workbooks(1).Worksheets("Master").Range("D6", Range("D6").End(xlDown))
Range("D3") = Application.WorksheetFunction.CountA(myRange)
End Sub

I have tried countless ways to rewrite the COUNTIF line with no results or compiler errors returned. Originally had problems with the SUM and COUNTIF function and found that column formating was the problem. After clearing all column formats, the SUM function promptly began working but the COUNTIF keeps eluding all my efforts. The column which the COUNTIF is pointed to contains values of 0 to 500. Only values greater than 0 are to be counted.

## Adding Rows And Products Based On Counta

Sep 16, 2013

I am trying to write a VBA code that does the following: The table below provides a sample of the Source (i.e how we start off with) and the Result (i.e how the format needs to look like). More specifically, for each product in 1st column that has a number in blue and or red column i need a row inserted immediately below (hence the counta function to indicate how many empty rows to insert). The end result should have a separate line for each blue/red colour depending if there is a number shown in the source data. Obviously the result should be displayed in another sheet (i.e sheet2).

PRODUCT
BLUE
RED
COUNTA

PROD A
9902

1

[Code] .......

## COUNTA IF Criteria Based On 2nd Column

Nov 12, 2012

I have a sheet with 2 columns. First Column lists sizes of Devices. Second colum lists a servername. Example:

A B
30 server_a
30 server_a
65 server_a
65 server_a
45 server_b
45 server_b
15 server_b

What I want to do is a device count, not device sum on a criteria based on Column B.

For instance whenever column B equals servername A, then count how many devices it has.

This would equal 4 instead of 190 which is the sum of the devices. I can do a sumif statement, very easily, but I don't want a sum, I just want a count.

## Sumproduct Vs Countif

Jul 2, 2009

I have a worksheet where I am trying to count the number of occurences of several text strings.

For example:

I'm trying to count how many times "paid in full" and "fully paid" occur in column A.

I have two formulas, and both seem to work, but since I don't really understand either of them, I'm wondering which I should use and how I would adapt it to include additional text strings. (Like adding "paid" to the list)

Here are my formuals (I didn't write either of them, another co-worker did)

=(COUNTIF(A:A,"paid in full"))+(COUNTIF(A:A,"fully paid"))

=SUMPRODUCT(--(A1:A50={"paid in full","fully paid"}))

Also, if there is another and easier way to do what I'm trying to do, I'd love to know.

## Sumproduct/Countif

Jun 29, 2006

I am working off a seperate worksheet and trying to use a Sumproduct with multiple criterias along with one criteria that calculate all fileds that =<45. The formula I am using is listed below. I get #VALUE!

=SUMPRODUCT(--('Q2-PDR Query BW'!A1:A200="Yes"),--('Q2-PDR Query BW'!B1:B200="Health Net"),--('Q2-PDR Query BW'!C1:C200="Closed"),--('Q2-PDR Query BW'!U1:U200="<=45"))

## Countif/Sumproduct Function?

Mar 9, 2009

I am trying to count number of staff working in any day without deleting the empty cells.(see attached sample sheet). I tried sumproduct as I have two criteria but it is giving me a "zero" result. I only want to count cells in range B3:B32 that does not have "#" sign if there is a staff name if there is a staff name id corresponding cell in Column A within A3:A32.

## Using Weeknum With Countif Or Sumproduct

Feb 24, 2014

Essentially I have the following:

Sheet 1 (raw data)
column a = day
column b = weeknum
column c = Employee Name (5 names)

Sheet 2 (sheet I would like to create graphs)

I need to sum total records of each employee per week. For example:

column a2:a6 are each possible employee name
column b1:h1 are weeknums 1-7

I've tried countif but I'm only able to make that work if there's a helper column.

## Change Sumproduct To Countif(and(

Apr 8, 2009

Change Sumproduct to countif(and(. I'm using this formula

## Sumproduct/Countif/And/Or Query

Feb 14, 2008

a calculation that has some conditions. I have a spreadsheet where I am calculating how many cells fall within a month date range using forumla :=SUMPRODUCT(('Project Team Actions'!J8:J525S2)) - as it calculates via other worksheets, but I only want it to count the cells that have OPEN or On Going in a neighbouring column, but not count the items that are closed.

## Countif/sumproduct Formula

Oct 22, 2008

I have a sheet with repeated dates for several months and I need to break out data by week and then by certain criteria. I can do 1 or the other but combining the COUNTIF formula and the SUMPRODUCT formula has proven to be beyond me.

I have this now:

=SUMPRODUCT(--(D2:D31719"7/19/2008"+0),--(G2:G31719>"5"))

but it returns a value of 0 which is incorrect.

What I need to do is have the formula return a sum of all of the fields in colG that are >5 within a date range. Once I find that # I have to divide it by another field and multiply by 100 to get the percent.

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

## Countif Or Sumproduct Function (count In A Range)

May 6, 2009

I am trying to do a basic count in a range, however am a little brain fried and its not working. On attachment, column D is to list all times out of column A and B listing only unique entries (have tried to use Macro with advanced filter however not liking it being an extract). Column E is to be a count of how many times the break time in Column D appears.

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

## Index/Match From Sumproduct/Countif Result

Feb 27, 2010

I am using this to count how many times a particular number appears across numerous sheets, My sheets are in a Named Range MySheets....

=SUMPRODUCT(COUNTIF(INDIRECT("'"&MySheets&"'!A2:A30"),A2))

This works great.
What I now need to do is to find ALL matches and return B1 from those sheets..

GHIJKLM1Countif ResultFirst ResultSecond ResultThird ResultFourth ResultFifth ResultSixth Result25AppleBananaPearMangoOrange31Banana43BananaMangoOrange

I have played around and the closest I can get is with this...

=IF(COUNTIF(INDIRECT("'"&MySheets&"'!A2:A30"),\$A2),INDIRECT("'"&MySheets&"'!B1"))

This as you may know only returns the result B1 from the first sheet within MySheets.

## Combine SUMPRODUCT, SUMIF, COUNTIF Within Date Range

Jan 13, 2007

The attached spreadsheet has a "master" workesheet in which I enter customer info, salesperson info, and date. The totals spreadsheet automatically calculates number of sales, contact value.

I need to modify the following formulas to only calculate the data within a date range shown in 2 cells.

=COUNTIF(Master!A1:A176,PayPeriod!A4)
=SUMPRODUCT(--(Master!A1:A176=Totals!A4),(Master!K1:K176))
=E4SUMPRODUCT(--(Master!A1:A176=Totals!A4),(Master!K1:K176))

## Can Use SUMPRODUCT And Average Together?

May 24, 2012

Can i use SUMPRODUCT and average together? ?

I am using sumproduct to sum the total number of transactions in each country. The argument is =SUMPRODUCT(--(Sheet1!\$C\$1:\$C\$9999),--(Sheet1!\$AB\$1:\$AB\$9999=Sheet2!A4))

The Firts part C:C is a list of every transaction value, the second is the country to which the transaction took place in. is there an easy way to obtain the average transaction value as te countries are spread over the list?

## SUMIF/COUNTIF = Average

Mar 13, 2008

I have a report that has thirteen tabs. Tab one is Jan; two, Feb; three, Mar, etc. The last tab is where I'm consolidating all the data into a report.

In Row 2 of Jan-Dec are the days of the week.
In Row 30 I have the data.

I am figuring the average of each day of the week for each month as well as a total average year-to-date.

Here is my formula for Jan and Feb:
=SUMIF(JAN!\$2:\$2,"MON",JAN!\$30:\$30)/COUNTIF(JAN!\$2:\$2,"MON")
=SUMIF(FEB!\$2:\$2,"MON",FEB!\$30:\$30)/COUNTIF(FEB!\$2:\$2,"MON")

Works great after the month is over - but now I'm in March and the formula is adding all data form row 30 that falls under MON and dividing my all MONs even if it does not have data.

How do I nest in the COUNTIF statement to only count MON IF there is data in row 30.

## Sumproduct To Find Average

May 25, 2008

I have 3 excel sheets (A,B and C) linked to a master sheet (X). In each sheet (A,B and C), people enter unique idetifier in first column, its type (mr, ab, J) in the second column, start date in the third column and finish date in the fourth column. At the end of every week, i subtract each start date from the finish date and get the number of days spent for each unique idetifier (column N). I preiously posted a thread (Calculate difference between dates excluding weekends) to inquire about how to calculate the difference between finish date and start date and exclude the weekends. I received some nice solutions, but none has worked as the start date cane be weekend as well.

My second and major query is once i have the difference in weekedays for each unique identifier in all the three sheets, I want to calcuate the average of each identifier type (mr, ab and J) in the master sheet. In the master sheet, i have used sumproduct to calculate the average of each idetifier type from column N for each sheet. That means i have a column for A sheet, subdivided into three types, which include the average. I am using sumproduct for this. Once this is done for each sheet type, i need a final colum in the master sheet that calculates average of all mr from A, B and C together, and similarly for ab and J. The problem here is if i combine all the sumproduct formula, i am not gettng the right answer.

My formula looks like SUMPRODUCT((SheetA!\$E\$5:\$E\$40="mr")*(SheetA!\$M\$5:\$M\$40)) for all mr in sheet A. I then divide this by SUMPRODUCT((SheetA!\$E\$5:\$E\$40="mr")*(SheetA!\$M\$5:\$M\$40<>"")) to get the average of all mrs in sheet A. I do the same for sheet B and sheet C for all three identifier types. Now i want to combine the formula for all sheets together under mr, Ab and J. I thought the following should work ((SUMPRODUCT((SheetA!\$E\$5:\$E\$40="mr")*(SheetA!\$M\$5:\$M\$40))+(SUMPRODUCT((SheetB!\$E\$5:\$E\$40="mr")*(She etB!\$M\$5:\$M\$40))+(SUMPRODUCT((SheetC!\$E\$5:\$E\$40="mr")*(SheetC!\$M\$5:\$M\$40)))/((SUMPRODUCT((SheetA!\$E\$5:\$E\$40="mr")*(SheetA!\$M\$5:\$M\$40<>""))+((SUMPRODUCT((SheetB!\$E\$5:\$E\$40="mr") *(SheetB!\$M\$5:\$M\$40<>""))+((SUMPRODUCT((SheetC!\$E\$5:\$E\$40="mr")*(SheetC!\$M\$5:\$M\$40<>""))).....
But this is giving me wrong value. It is working fine when done for individual sheets, but when combined for all three sheets together, the value is wrong.

## Average Age Of Sumproduct Range?

Nov 3, 2011

(SUMPRODUCT(--('Job'!\$F\$2:\$F\$1000="CCTV"),--('List'!\$S\$2:\$S\$1000="pass")))

There is another column with 'released' date (date the job was raised)

How would i implement a formula to calculate the average age of a certain job type in the above example?

## Finding An Average With Sumproduct

Jan 2, 2009

I’m using the following formula:

SUMPRODUCT(--(Issue="Yes"),--(Month=Aug),--(Building=\$A\$9))

To find the number of instances where there was an issue in a certain building during a certain month.

What I can’t figure out is how to find the Average number of such instances for the past 3 months, the last 6 months & the trailing twelve months. If I change the formula to:

SUMPRODUCT(--(Issue="Yes"),--(Month>April),--(Building=\$A\$9))

I get the correct sum for the months of May, June, July & Aug but I need an average number of instances per month for the last three, last 6 and TTM but not to include the current month.

## Sumproduct - Average With Multiple Conditions?

May 7, 2012

I need to average with multiple conditions. Is there a way for sumproduct to do such a thing? How to average with conditions?

## Dollar Weighted Average Sumproduct Formula:

Dec 1, 2009

I've been trying to figure out a dollar weighted average formula in excel.

See attached file...

In sheet 1, I need to pull data from sheet 2 using a sumproduct formula to find the dollar weighted average maturity of a bond portfolio. Basically, I need to know how many days the portfolio has left to mature according to the portfolio's weighting by the amount in column H.