{"id":3424,"date":"2017-11-14T15:18:20","date_gmt":"2017-11-14T21:18:20","guid":{"rendered":"https:\/\/www.vertex42.com\/blog\/?p=3424"},"modified":"2020-09-28T09:17:26","modified_gmt":"2020-09-28T15:17:26","slug":"sumif-and-countif-in-excel","status":"publish","type":"post","link":"https:\/\/www.vertex42.com\/blog\/excel-formulas\/sumif-and-countif-in-excel.html","title":{"rendered":"SUMIF and COUNTIF in Excel"},"content":{"rendered":"<p>SUMIF, SUMIFS, COUNTIF, and COUNTIFS are extremely useful and powerful for data analysis. If there was an Excel Function Hall of Fame, this family of functions ought to be included. In this article, I'll demonstrate a bunch of different ways to use these functions, focusing mainly on all the different criteria types.<\/p>\n<div class=\"feature-image\" itemprop=\"image\" itemscope=\"\" itemtype=\"https:\/\/schema.org\/ImageObject\">\n<img decoding=\"async\" src=\"https:\/\/cdn.vertex42.com\/blog\/images\/excel-formulas\/feature-sumifs-countifs-functions.png\" alt=\"SUMIF, SUMIFS, COUNTIF, COUNTIFS in Excel (Power Functions)\" style=\"max-width:100%;margin:1em auto;\"><meta itemprop=\"url\" content=\"https:\/\/cdn.vertex42.com\/blog\/images\/excel-formulas\/feature-sumifs-countifs-functions.png\"><meta itemprop=\"width\" content=\"1200\"><meta itemprop=\"height\" content=\"628\"><\/div>\n<p>The <strong>SUMIF<\/strong> and <strong>COUNTIF<\/strong> functions allow you to conditionally sum or count cells based on a <b>single condition<\/b>, and are compatible with almost all versions of Excel:<\/p>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">criteria_range<\/span>, <span class=\"arg\"><span class=\"green\">criteria<\/span><\/span>, <span class=\"arg\">sum_range<\/span>)<\/pre>\n<pre class=\"XLformula light\">=<span class=\"function\">COUNTIF<\/span>(<span class=\"arg\">criteria_range<\/span>, <span class=\"arg\"><span class=\"green\">criteria<\/span><\/span>)<\/pre>\n<p>The <strong>SUMIFS<\/strong> and <strong>COUNTIFS<\/strong> functions allow you to use <b>multiple criteria<\/b>, but are only available beginning with Excel 2007:<\/p>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIFS<\/span>(<span class=\"arg\">sum_range<\/span>, <span class=\"arg\">criteria_range1<\/span>, <span class=\"arg\"><span class=\"green\">criteria1<\/span><\/span>, <span class=\"arg\">criteria_range2<\/span>, <span class=\"arg\"><span class=\"green\">criteria2<\/span><\/span>,...)<\/pre>\n<pre class=\"XLformula light\">=<span class=\"function\">COUNTIFS<\/span>(<span class=\"arg\">criteria_range1<\/span>, <span class=\"arg\"><span class=\"green\">criteria1<\/span><\/span>, <span class=\"arg\">criteria_range2<\/span>, <span class=\"arg\"><span class=\"green\">criteria2<\/span><\/span>,...)<\/pre>\n<p>AVERAGEIF and AVERAGEIFS are also part of this family of functions and have the same syntax as SUMIF and SUMIFS.<\/p>\n<div class=\"contents\">\n<p>This Article (bookmarks):<\/p>\n<ul>\n<li><a href=\"#examples\">SUMIF and COUNTIF Examples<\/a><\/li>\n<li><a href=\"#dates\">Usings Dates as Criteria<\/a><\/li>\n<li><a href=\"#sumifs-example\">SUMIFS Example: Income and Expense Report<\/a><\/li>\n<li><a href=\"#between-two-numbers\">SUMIF and COUNTIF Between Two Numbers (1&lt;x&lt;10)<\/a><\/li>\n<li><a href=\"#or-conditions\">SUMIF and COUNTIF with OR conditions<\/a><\/li>\n<li><a href=\"#criteria\">Summary Table of Criteria Types<\/a><\/li>\n<li><a href=\"#case-sensitive\">Case-Sensitive Match Using SUMPRODUCT<\/a><\/li>\n<li><a href=\"#maxifs\">MAXIFS and MINIFS<\/a><\/li>\n<li><a href=\"#notes\">Other Notes<\/a><\/li>\n<\/ul>\n<\/div>\n<h2 id=\"examples\">1) SUMIF and COUNTIF Examples<\/h2>\n<p>We'll start off by using a product sales table to demonstrate a few different SUMIF and COUNTIF formulas. I've listed a few of these examples below. To see these formulas in action and try them out yourself, you can download the example file below:<\/p>\n<p class=\"downloadlink\"><span class=\"icon16 excel\"><\/span><a href=\"\/Files\/examples\/SumIf-CountIf.xlsx\" onClick=\"ga('send','event', 'Downloads', 'Examples', 'SumIf-CountIf.xlsx');\" class=\"bigbtn\" rel=\"nofollow\"><b>Download the Example File<\/b><\/a> (SumIf-CountIf.xlsx)<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cdn.vertex42.com\/blog\/images\/excel-formulas\/sales-table-for-demonstrating-sumif-countif.png\" alt=\"Sales Table for Demonstrating SUMIF and COUNTIF\" class=\"imgshadow\"><\/p>\n<h3>Criteria are Text Values<\/h3>\n<h4>Example: Sum of Sales where Category equals \"student\"<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">category_range<\/span>,<span class=\"green\">\"student\"<\/span>,<span class=\"arg\">sales_range<\/span>)<\/pre>\n<div class=\"note-box\">\n<p><span class=\"note-label\">NOTE<\/span> This formula will also match \"Student\" because the SUMIF family of functions are <b>not case-sensitive<\/b>. You can use <b>wildcard characters<\/b> within the text string, such as <b>\"?s*\"<\/b> to match values where the second letter is s.<\/p>\n<\/div>\n<h3>Not Equal To (&lt;&gt;)<\/h3>\n<h4>Example: Sum of Sales where Model is NOT equal to \"B\"<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">model_range<\/span>,<span class=\"green\">\"&lt;&gt;B\"<\/span>,<span class=\"arg\">sales_range<\/span>)<\/pre>\n<h4>Example: Sum of Sales where Category does NOT contain the letter \"u\"<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">category_range<\/span>,<span class=\"green\">\"&lt;&gt;*u*\"<\/span>,<span class=\"arg\">sales_range<\/span>)<\/pre>\n<h3>Criteria is an Alphabetical Text Comparison<\/h3>\n<h4>Example: Sum of Sales where Model is less than \"C\"<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">model_range<\/span>,<span class=\"green\">\"&lt;C\"<\/span>,<span class=\"arg\">sales_range<\/span>)<\/pre>\n<h3>Criteria is a Numeric Comparison<\/h3>\n<h4>Example: Number of products priced over $40<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">COUNTIF<\/span>(<span class=\"arg\">price_range<\/span>,<span class=\"green\">\"&gt;40\"<\/span>)<\/pre>\n<div class=\"note-box\">\n<p><span class=\"note-label\">NOTE<\/span> When using numeric criteria, COUNTIF and SUMIF ignore text values. Numeric date values can be an exception to that (see below for date comparisons).<\/p>\n<\/div>\n<h3>Criteria matches Blank Cells or Empty Cells<\/h3>\n<h4>Example: Count of products where On Sale is blank<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">COUNTIF<\/span>(<span class=\"arg\">on_sale_range<\/span>,<span class=\"green\">\"\"<\/span>)<\/pre>\n<h3>Criteria matches Non-Blank Cells<\/h3>\n<h4>Example: Number of products on sale (where On Sale is not blank)<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">COUNTIF<\/span>(<span class=\"arg\">on_sale_range<\/span>,<span class=\"green\">\"&lt;&gt;\"<\/span>)<\/pre>\n<h3>Criteria includes a Cell Reference<\/h3>\n<h4>Example: Sum of Sales where Price is greater than the value in cell H3<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">price_range<\/span>,<span class=\"green\">\"&gt;\"&amp;H3<\/span>,<span class=\"arg\">sales_range<\/span>)<\/pre>\n<h3>Criteria is In Another Cell<\/h3>\n<h4>Example: Sum of Sales using the criteria defined in cell K9<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">criteria_range<\/span>,<span class=\"green\">K9<\/span>,<span class=\"arg\">sales_range<\/span>)<\/pre>\n<div class=\"note-box\">\n<p><span class=\"note-label\">NOTE<\/span> This technique is useful when you want to allow the user to choose or enter different criteria or search strings.<\/p>\n<p>The cell K9 could contain a value like \"student\" or \"40\" or a criteria string such as \"&gt;40\" or \"&lt;&gt;student\"<\/p>\n<\/div>\n<h3>Multiple Criteria<\/h3>\n<h4>Example: Sum of Sales where Category = \"student\" <b>AND<\/b> Price &gt; 30<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIFS<\/span>(<span class=\"arg\">sales_range<\/span>,<span class=\"arg\">category_range<\/span>,<span class=\"green\">\"student\"<\/span>,<span class=\"arg\">price_range<\/span>,<span class=\"green\">\"&gt;30\"<\/span>)<\/pre>\n<h4>Example: SUMIFS between two dates<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIFS<\/span>(<span class=\"arg\">sum_range<\/span>,<span class=\"arg\">date_range<\/span>,<span class=\"green\">\"&gt;=1\/1\/2017\"<\/span>,<span class=\"arg\">date_range<\/span>,<span class=\"green\">\"&lt;1\/31\/2017\"<\/span>)<\/pre>\n<div class=\"note-box\">\n<p><span class=\"note-label\">NOTE<\/span> The SUMIFS, COUNTIFS, and AVERAGEIFS functions are used for multiple AND conditions. Formulas for OR conditions are a bit more tricky (see below).<\/div>\n<h2 id=\"dates\">2) Using Dates as Criteria<\/h2>\n<p>When using dates as criteria for the COUNTIF and SUMIF functions, Excel does some interesting things, depending on whether you are using \"=\" or \"&lt;\" as the criteria and whether the dates in the criteria range are stored as numeric date values or text values.<\/p>\n<p><b>Remember<\/b>: Date values are stored in Excel as sequential numbers starting with 1 for 1\/1\/1900. The cell formatting may display the date in different ways, but COUNTIF and SUMIF comparisons are based on the value stored in the cell, not the way a cell is formatted. That is a good, because we normally want to compare dates and numbers without having to worry about how they are formatted.<\/p>\n<h3>Criteria is a Date<\/h3>\n<pre class=\"XLformula light\">=<span class=\"function\">COUNTIF<\/span>(<span class=\"arg\">criteria_range<\/span>,<span class=\"green\">\"=3\/1\/17\"<\/span>)<\/pre>\n<p>When using criteria such as \"=3\/1\/17\" or \"Mar 1, 2017\", Excel will recognize the criteria as a date and will count all <i>date values<\/i> in the <i>criteria_range<\/i> matching that date. Excel will ALSO count recognized dates stored as <i>text values<\/i> in the <i>criteria_range<\/i>, such as \"March 1, 2017\" and \"3\/1\/2017\" (but not \"March 1st, 2017\" because Excel doesn't recognize it as a date).<\/p>\n<h3>Criteria is Greater or Less than a Date<\/h3>\n<pre class=\"XLformula light\">=<span class=\"function\">COUNTIF<\/span>(<span class=\"arg\">criteria_range<\/span>,<span class=\"green\">\"&gt;3\/1\/17\"<\/span>)<\/pre>\n<p>When using &lt;, &gt;, &lt;=, or &gt;=, Excel still recognizes the criteria as a date, but it does <b>not<\/b> convert text values in the <i>criteria_range<\/i> to date values.<\/p>\n<h3>Comparison to TODAY<\/h3>\n<p>You can use the TODAY function to make comparisons based on the current date, like this:<\/p>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">date_range<\/span>,<span class=\"green\">\"&lt;\"&amp;TODAY()<\/span>,<span class=\"arg\">sum_range<\/span>)<\/pre>\n<h2 id=\"sumifs-example\">3) SUMIFS Example: Income and Expense Report<\/h2>\n<p>SUMIFS is very useful in <a href=\"\/ExcelTemplates\/account-register.html\">account registers<\/a>, budgeting, and <a href=\"\/ExcelTemplates\/money-management-template.html\">money management<\/a> spreadsheets for summarizing expenses by category and between two dates.<\/p>\n<p>The SUMIFS example below sums the Amount column with 3 criteria: (1) the Category matches \"Fuel\", (2) the Date is greater than or equal to the start date, and (3) the Date is less than or equal to the end date.<\/p>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIFS<\/span>(<span class=\"arg\">amount_range<\/span>, <span class=\"arg\">category_range<\/span>, <span class=\"green\">\"Fuel\"<\/span>, <span class=\"arg\">date_range<\/span>, <span class=\"green\">\"&gt;=1\/1\/2018\"<\/span>, <span class=\"arg\">date_range<\/span>, <span class=\"green\">\"&lt;=1\/31\/2018\"<\/span>)<\/pre>\n<p>The following screenshot shows an example from the download file:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cdn.vertex42.com\/blog\/images\/excel-formulas\/sumifs-example-income-and-expense-report.png\" alt=\"SUMIFS Example - An Income and Expense Report\" width=\"730\" height=\"355\" class=\"imgshadow\"><\/p>\n<h2 id=\"between-two-numbers\">4) SUMIF and COUNTIF Between Two Numbers (1 &lt; x &lt; 4)<\/h2>\n<p>COUNTIFS and SUMIFS can easily handle a condition such as 1 &lt; x &lt; 4 (which means x &gt; 1 AND x &lt; 4). However, if you are trying to make a spreadsheet compatible with older versions of Excel, you can use COUNTIF or SUMIF by subtracting the results of the condition x &lt;= 1 from the results of the condition x &lt; 4.<\/p>\n<table class=\"style2\">\n<tr>\n<th>Condition<\/th>\n<th>Formula using COUNTIFS<\/th>\n<\/tr>\n<tr>\n<td>1 &lt; x &lt; 4<\/td>\n<td>=COUNTIFS(<i>range<\/i>,\">1\",<i>range<\/i>,\"&lt;4\")<\/td>\n<\/tr>\n<tr>\n<th>Condition<\/th>\n<th>Formula using only COUNTIF<\/th>\n<\/tr>\n<tr>\n<td>1 &lt; x &lt; 4<\/td>\n<td>=COUNTIF(<i>range<\/i>,\"&lt;4\") - COUNTIF(<i>range<\/i>,\"&lt;=1\")<\/td>\n<\/tr>\n<tr>\n<td>1 &lt;= x &lt; 4<\/td>\n<td>=COUNTIF(<i>range<\/i>,\"&lt;4\") - COUNTIF(<i>range<\/i>,\"&lt;1\")<\/td>\n<\/tr>\n<tr>\n<td>1 &lt; x &lt;= 4<\/td>\n<td>=COUNTIF(<i>range<\/i>,\"&lt;=4\") - COUNTIF(<i>range<\/i>,\"&lt;=1\")<\/td>\n<\/tr>\n<tr>\n<td>1 &lt;= x &lt;= 4<\/td>\n<td>=COUNTIF(<i>range<\/i>,\"&lt;=4\") - COUNTIF(<i>range<\/i>,\"&lt;1\")<\/td>\n<\/tr>\n<\/table>\n<p>A common need for these formulas is to sum values between two dates. Remember that date values are stored as numbers.<\/p>\n<h3>Example: SUMIF between two dates ( 1\/1\/2017 &lt;= date &lt;= 1\/31\/2017 )<\/h3>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">sum_range<\/span>,<span class=\"arg\">date_range<\/span>,<span class=\"green\">\"&lt;=1\/31\/2017\"<\/span>)-<span class=\"function\">SUMIF<\/span>(<span class=\"arg\">sum_range<\/span>,<span class=\"arg\">date_range<\/span>,<span class=\"green\">\"&lt;1\/1\/2017\"<\/span>)<\/pre>\n<h2 id=\"or-conditions\">5) SUMIF and COUNTIF with OR Conditions<\/h2>\n<p>COUNTIFS and SUMIFS handle multiple AND conditions, but OR conditions such as X&lt;2 OR X&gt;3 are usually easier to handle by evaluating each condition separately and then adding the results. The two formulas below do essentially the same thing.<\/p>\n<table class=\"style2\">\n<tr>\n<th>Condition<\/th>\n<th>Formula<\/th>\n<\/tr>\n<tr>\n<td>x &lt; 2 or 3 &lt; x<\/td>\n<td>=COUNTIF(<i>range<\/i>,\"&lt;2\") <b>+<\/b> COUNTIF(<i>range<\/i>,\"&gt;3\")<\/td>\n<\/tr>\n<tr>\n<td>x &lt; 2 or 3 &lt; x<\/td>\n<td>=SUM(COUNTIF(<i>range<\/i>,{\"&lt;2\",\"&gt;3\"}))<\/td>\n<\/tr>\n<\/table>\n<p>To avoid double-counting cells, the conditions must not overlap. For example, the condition \"=*e*\" would overlap with the condition \"=yes\". The condition \"&lt;40\" would overlap with the condition \"&gt;20\". If the conditions overlap, you may end up counting or adding a value twice. If there is a possibility of conditions overlapping, then you may need to use a SUMPRODUCT formula as explained below.<\/p>\n<h3>Use SUMPRODUCT for overlapping OR conditions<\/h3>\n<p>The key to avoid double-counting is to recognize that FALSE+FALSE=0 and TRUE+FALSE=1 and TRUE+TRUE=2. This means that for a logical OR condition to be true, we can check whether the sum of two or more conditions is &gt; 0.<\/p>\n<h4>Sum of Sales where Model is equal to A or B.<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMPRODUCT<\/span>(<span class=\"arg\">sales<\/span>,1*( ((<span class=\"arg\">model<\/span>=\"A\")+(<span class=\"arg\">model<\/span>=\"B\"))&gt;0 ))<\/pre>\n<h4>Sum of Sales where Model = \"A\" or Price &gt; 45<\/h4>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMPRODUCT<\/span>(<span class=\"arg\">sales<\/span>,1*( ((<span class=\"arg\">model<\/span>=\"A\")+(<span class=\"arg\">price<\/span>&gt;45))&gt;0 ))<\/pre>\n<h2 id=\"case-sensitive\">6) Case-Sensitive SUMIF and COUNTIF<\/h2>\n<p>The SUMIF family does not have a case-sensitive option, so we need to resort back to using array formulas or SUMPRODUCT. The FIND and EXACT functions both provide a way to do case-sensitive matches.<\/p>\n<h3>Sum of Sales where Category exactly matches \"student\" (case-sensitive)<\/h3>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMPRODUCT<\/span>(<span class=\"arg\">sales<\/span>,1*<span class=\"function\">EXACT<\/span>(<span class=\"arg\">category<\/span>,<span class=\"green\">\"student\"<\/span>))<\/pre>\n<h3>Sum of Sales where Category contains \"Stu\" (case-sensitive)<\/h3>\n<pre class=\"XLformula light\">=<span class=\"function\">SUMPRODUCT<\/span>(<span class=\"arg\">sales<\/span>,1*<span class=\"function\">ISNUMBER<\/span>(<span class=\"function\">FIND<\/span>(<span class=\"green\">\"Stu\"<\/span>,<span class=\"arg\">category<\/span>)))<\/pre>\n<h2 id=\"maxifs\">7) MAXIF or MINIF Formula<\/h2>\n<p><strong>MAXIFS<\/strong> and <strong>MINIFS<\/strong> are new Excel functions available in the latest releases (Excel for Microsoft 365, Excel 2019). Their syntax is similar to SUMIFS, allowing you to use multiple criteria.<\/p>\n<p>Older versions of Excel do not have the MAXIFS or MINIFS functions, but you can use an <a href=\"\/blog\/excel-formulas\/array-formula-examples.html\">array formula<\/a> like this (remember to press Ctrl+Shift+Enter):<\/p>\n<h3>Example: Find the maximum Price where Model = \"A\"<\/h3>\n<pre class=\"XLformula light\">(array formula) =<span class=\"function\">MAX<\/span>(<span class=\"function\">IF<\/span>(<span class=\"arg\">model_range<\/span>=\"A\",<span class=\"arg\">price_range<\/span>,\"\"))<\/pre>\n<h2 id=\"criteria\">8) Summary of Different Criteria Types<\/h2>\n<table class=\"style2\">\n<tr>\n<th>CRITERIA TYPE<\/th>\n<th>EXAMPLE<\/th>\n<th>MATCHES ...<\/th>\n<\/tr>\n<tr>\n<td>Text Value<\/td>\n<td>\"yes\" or \"=yes\"<\/td>\n<td>\"yes\" or \"Yes\" (not case-sensitive), the equal sign is optional<\/td>\n<\/tr>\n<tr>\n<td>Text Value with Wildcards<\/td>\n<td>\"=?s*\"<\/td>\n<td>text values where the second letter is \"s\" or \"S\"<\/td>\n<\/tr>\n<tr>\n<td>Alphabetical Text Comparison<\/td>\n<td>\"&lt;C\"<\/td>\n<td>text values alphabetically less than \"C\"<\/td>\n<\/tr>\n<tr>\n<td>Equal to a Numeric Value<\/td>\n<td>20 or \"=20\"<\/td>\n<td>numeric values equal to 20<\/td>\n<\/tr>\n<tr>\n<td>Less than or Equal to<\/td>\n<td>\"&lt;=20\"<\/td>\n<td>numeric values less than or equal to 20<\/td>\n<\/tr>\n<tr>\n<td>Greater than or Equal to<\/td>\n<td>\">=20\"<\/td>\n<td>numeric values greater than or equal to 20<\/td>\n<\/tr>\n<tr>\n<td>Not Equal to<\/td>\n<td>\"&lt;&gt;0\"<\/td>\n<td>values not equal to the value 0<\/td>\n<\/tr>\n<tr>\n<td>Non-Blank<\/td>\n<td>\"&lt;&gt;\"<\/td>\n<td>values that are not blank (formulas returning \"\" are not blank)<\/td>\n<\/tr>\n<tr>\n<td>Blank or Empty<\/td>\n<td>\"\"<\/td>\n<td>values that are blank and formulas that return \"\"<\/td>\n<\/tr>\n<tr>\n<td>Equal to a Cell Value<\/td>\n<td>A42 or \"=\"&amp;A42<\/td>\n<td>values equal to the value in cell A42<\/td>\n<\/tr>\n<tr>\n<td>Comparison to a Cell Value<\/td>\n<td>\"&gt;\"&amp;A42<\/td>\n<td>values greater than the value in cell A42<\/td>\n<\/tr>\n<tr>\n<td>Equal to a Date<\/td>\n<td>\"=3\/1\/17\"<\/td>\n<td>date values equal to 3\/1\/17 as well as text values such as \"3\/1\/17\" or \"Mar 1, 2017\"<\/td>\n<\/tr>\n<tr>\n<td>&lt; or &gt; a Date<\/td>\n<td>\"&gt;1\/1\/2017\"<\/td>\n<td>date values greater than 1\/1\/2017 (text values are ignored)<\/td>\n<\/tr>\n<\/table>\n<p>Some criteria, such as case-sensitive matches, may only be possible with array formulas or SUMPRODUCT.<\/p>\n<p>You don't use the functions AND, NOT, OR, ISBLANK, ISNUMBER, ISERROR, or other similar functions as criteria for SUMIF and COUNTIF. However, you <em>can<\/em> use these functions within a SUMPRODUCT formula (but that isn't within the scope of this article).<\/p>\n<h2 id=\"notes\">9) Other Notes<\/h2>\n<ul>\n<li>Comparisons are based on the value stored in the cell, not on how the cell is formatted.<\/li>\n<li>Error values in both the <i>sum_range<\/i> and <i>criteria_range<\/i> are ignored.<\/li>\n<li>SUMIFS and COUNTIFS formulas are generally faster than their SUMPRODUCT or array formula counterparts.<\/li>\n<li>The <i>sum_range<\/i> and <i>criteria_range<\/i> arguments can be references (e.g. A2:A42), named ranges or formulas that return a range (such as INDEX, OFFSET, or INDIRECT).<\/li>\n<li>Normally, you'll want the <i>sum_range<\/i> and <i>criteria_range<\/i> to be the same length. See the documentation on the Microsoft sites (referenced below) for information about what happens when the <i>sum_range<\/i> and <i>criteria_range<\/i> are not the same length.<\/li>\n<li>The COUNTIF and SUMIF criteria can be a range (e.g. A2:A3) if you enter the formula as an array formula using Ctrl+Shift+Enter.<\/li>\n<li>The COUNTIF and SUMIF criteria can be a list such as {\"&gt;1\",\"&lt;4\"}, but functions return an array containing results for the separate conditions, not a sum of both conditions (it is not the same as COUNTIFS or SUMIFS).<\/li>\n<\/ul>\n<h3>Some Templates that Use SUMIF<\/h3>\n<ul class=\"bulletlist\">\n<li><a href=\"\/ExcelTemplates\/invoice-tracker.html\">Invoice Tracker<\/a> - Uses SUMIF to create an Aging table that shows unpaid invoices past 30 days, 60 days, etc.<\/li>\n<li><a href=\"\/ExcelTemplates\/account-register.html\">Account Register<\/a> - Uses a cumulative SUMIF formula to show the current account balance within the register.<\/li>\n<li><a href=\"\/ExcelTemplates\/weekly-budget.html\">Weekly Money Manager<\/a> - Uses SUMIF to show actual spending within a budget report.<\/li>\n<li><a href=\"https:\/\/www.vertex42.com\/ExcelTemplates\/excel-checkbook.html\">Checkbook Register<\/a> - Uses SUMIF to show the current cleared balance based on whether the reconcile column contains \"r\" or \"c\".<\/li>\n<\/ul>\n<h3>References<\/h3>\n<ul class=\"bulletlist\">\n<li><a href=\"\/ExcelTips\/workbook.html\">Spreadsheet Tips Workbook<\/a> - <i>vertex42.com<\/i> - by Jon Wittwer and Brent Weight<\/li>\n<li><a href=\"https:\/\/support.office.com\/en-us\/article\/SUMIF-function-169b8c99-c05c-4483-a712-1697a653039b\" target=\"_blank\" rel=\"noopener noreferrer\">SUMIF Function<\/a> - <i>support.office.com<\/i> - The official documentation of the SUMIF function.<\/li>\n<li><a href=\"https:\/\/support.office.com\/en-us\/article\/SUMIFS-function-C9E748F5-7EA7-455D-9406-611CEBCE642B\" target=\"_blank\" rel=\"noopener noreferrer\">SUMIFS Function<\/a> - <i>support.office.com<\/i> - The official documentation of the SUMIFS function.<\/li>\n<li><a href=\"https:\/\/support.office.com\/en-us\/article\/COUNTIF-function-e0de10c6-f885-4e71-abb4-1f464816df34\" target=\"_blank\" rel=\"noopener noreferrer\">COUNTIF Function<\/a> - <i>support.office.com<\/i> - The official documentation of the COUNTIF function.<\/li>\n<li><a href=\"https:\/\/support.office.com\/en-us\/article\/COUNTIFS-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842\" target=\"_blank\" rel=\"noopener noreferrer\">COUNTIFS Function<\/a> - <i>support.office.com<\/i> - The official documentation of the COUNTIFS function.<\/li>\n<li><a href=\"https:\/\/exceljet.net\/formula\/sumifs-with-multiple-criteria-and-or-logic\" target=\"_blank\" rel=\"noopener noreferrer\">SUMIFS With Multiple Criteria and OR Logic<\/a> - at <i>exceljet.net<\/i> - Describes how the function works when you use an array for the criteria such as {\"=A\",\"=B\"}.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>SUMIF, SUMIFS, COUNTIF and COUNTIFS are very powerful functions for data analysis. The hardest part is learning how to define the criteria for different types of comparisons. This article shows examples of all the different criteria types, including matching blank and non-blank values.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[79],"tags":[],"class_list":{"0":"post-3424","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-excel-formulas"},"_links":{"self":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/posts\/3424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/comments?post=3424"}],"version-history":[{"count":0,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/posts\/3424\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/media?parent=3424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/categories?post=3424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vertex42.com\/blog\/wp-json\/wp\/v2\/tags?post=3424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}