473,503 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use the COUNTIF, COUNTIFS and SUMPRODUCT Worksheet Functions in Excel

MMcCarthy
14,534 Recognized Expert Moderator MVP
These three Worksheet functions preform similar tasks but there are key differences between them. The COUNTIFS function is only available in Excel 2007 and later.

COUNTIF()
The COUNTIF function is used to "Count" instances of a set criteria in a given range. So you are counting the number of times your given criteria is true in the cells of whatever range you set.

The syntax for the function is:
COUNTIF ( Range, Criteria )

In this excample given below you can see the formula I used to test the function. In Cell Reference D2 I inserted the COUNTIF function to give me a count of the number of times in the Date_Entered (A2:A6) column the date was greater than 01/01/1980.




COUNTIFS()
The COUNTIFS function is used to do a similar job to the COUNTIF function except you can assign multiple criteria accross multiple ranges. However, all checks must be true before the count is incremented.

The syntax for the function is:
COUNTIFS ( Range, Criteria, Range2, Criteria2 ...[Range_n],[Criteria_n] )

In the first example below I use the same range for both criteria, this allows me to return a count of cells in that range that meets more than one criteria. Please note both criteria must be true. So I get a count of all cells in the Date_Entered (A2:A6) column where the date is between 01/01/1980 and 01/01/1990.



In the second example I add a second range with it's own criteria. So this time I get a count of the cells in the Date_Entered (A2:A6) column where the date is between 01/01/1980 and 01/01/1990 AND the Score (B2:B6) is greater than 75.




SUMPRODUCT()
The SUMPRODUCT function can be used instead of COUNTIFS if your Excel version is less than 2007. However, the formula is quite complicated. The SUMPRODUCTS function is more commonly used to multiply the corresponding values in two arrays. The arrays must be the same size and position as each other.

The syntax for the function is:
SUMPRODUCT ( Array_1, array_2, ...[Array_n] )

The first example shows the use of SUMPRODUCT to achieve a similar result to the COUNTIFS function. I have used the DATE function to represent the dates as the SUMPRODUCT function won't recognise a date directly entered.



The second example shows the more common usage of the SUMPRODUCT function to multiply corresponding values in two or more arrays. In this case (1*4) + (2*6) + (3*8) + (4*3) + (5*9) + (6*2) = 109.




Mary McCarthy
Bytes Admin
Attached Images
File Type: jpg CountIfs_1.jpg (74.3 KB, 13292 views)
File Type: jpg CountIfs_2.jpg (68.8 KB, 15636 views)
File Type: jpg SumProduct_1.jpg (60.1 KB, 11753 views)
File Type: jpg SumProduct_2.jpg (75.9 KB, 11663 views)
File Type: jpg Countif.jpg (86.7 KB, 22038 views)
May 20 '13 #1
0 22888

Sign in to post your reply or Sign up for a free account.

Similar topics

3
11382
by: Punky | last post by:
Hi all, I've created a workbook to play a game with my friends. Each time I insert results a new worksheet should be created (which happens) and then this worksheet should be activated. I'm fairly...
13
35482
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
0
4433
by: harshan | last post by:
Hi I am trying to read required worksheet from excel file using perl with module spreadsheet::parseexcel and spreadsheet::writeexcel but I am unable to read it, the error I am getting is...
1
1518
by: Davy | last post by:
Hi Can somebody help me to print a specific worksheet of an Excel file thru Visual Basic Thank Davy
1
2059
by: Rene | last post by:
Hi Proggies, i try to delete an excel worksheet but nothing happens (work on vb.net 2005) ..... xlSheet = xlApp.Sheets("Master") xlSheet.select xlSheet.delete also try
3
15264
by: Rene | last post by:
Hi Proggies, i try to delete an excel worksheet but nothing happens (work on vb.net 2005) ..... xlSheet = xlApp.Sheets("Master") xlSheet.select xlSheet.delete also try
0
1239
by: Strayrog | last post by:
Hi guys, I am attempting to combind several (about 50) text comma seperated value files and have them show up on one singe Excel worksheet. I wrote a macro that created a new sheet for each .csv...
2
3486
by: prinsipe | last post by:
Hi guys, i'm able to export data to an excel from my asp .net page, i can even create multiple worksheets. the problem is, i can not specify where worksheet should the data be placed. below is my...
1
1758
by: 9657703 | last post by:
Hi, I need assistance with creating a pop up box that will display information in excel. I need to read the values (could be YES or NO) from the sheet in a certain range/column (e.g. A1 to A15)....
4
2230
by: Greg Sovan | last post by:
MS Excel 2000 It works fine up until the line Here's the vba macro I have written for the button. Range(ActiveCell, ActiveCell.Offset(0, -6)).Select Range(ActiveCell, ActiveCell.Offset(0,...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.