{"id":30744,"date":"2021-02-03T17:20:32","date_gmt":"2021-02-03T16:20:32","guid":{"rendered":"https:\/\/blog.sheetgo.com\/?p=30744"},"modified":"2021-02-03T17:20:32","modified_gmt":"2021-02-03T16:20:32","slug":"funcao-countif-no-excel","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/pt\/blog\/excel-functions\/countif-function-in-excel\/","title":{"rendered":"Como usar a fun\u00e7\u00e3o CONT.SE no Excel"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; module_class=&#8221;sheetgo-post&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>A common task in Excel often involves taking a set of data and tallying the number of occurrences that match certain characteristics. The <a href=\"https:\/\/support.microsoft.com\/en-us\/office\/countif-function-e0de10c6-f885-4e71-abb4-1f464816df34\" target=\"_blank\" rel=\"noopener noreferrer\">COUNTIF Excel function<\/a> allows you to do just that: it counts the number of data points (cells) that meet a certain criteria that you specify within the function.<\/p>\n<p>Because of the wide range of criteria that you can input, the COUNTIF function allows you to filter your data in virtually any way you want.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3>Syntax<\/h3>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.16&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]=COUNTIF(range, criteria)[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<ul>\n<li><b>range<\/b> is the group of cells you wish to count<\/li>\n<li><b>criteria<\/b> is the characteristic that will decide whether or not each cell gets counted. This can be an expression, number, cell reference, or text string.<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3>How to use COUNTIF in Excel<\/h3>\n<h4>Criteria as text string<\/h4>\n<p>To illustrate some of the ways that you can use the COUNTIF function in Excel, take a look at the dataset below. It outlines the dietary preferences of a group of people. In the first example, I use COUNTIF to tally the number of vegetarians in the group by typing <b>=COUNTIF(D2:D9,&#8221;Yes&#8221;)<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/1.-Countif-text-string.png&#8221; alt=&#8221;countif excel 1&#8243; title_text=&#8221;1. Countif text string&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>In this example, the criterion that I\u2019ve specified is a text string. The function looks at all the cells in the range that I\u2019ve indicated, and returns the number of cells that match the criteria \u2013 in this case, the number of instances where &#8220;Yes&#8221; appears in the column.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4>Criteria as cell reference<\/h4>\n<p>Another way of indicating the criteria is to use a cell reference. Take a look at the example below. Here, I count the number of people with allergies by using cell E4 as my criteria. Of course, that cell contains the text string Yes, so this is just an alternative to typing \u201cYes\u201d into the formula.<\/p>\n<p>The formula I use here is <b>=COUNTIF(E2:E9,E4)<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/2.-Countif-cell-ref.png&#8221; alt=&#8221;countif excel 2&#8243; title_text=&#8221;2. Countif cell ref&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4>Criteria as a number<\/h4>\n<p>You can also put a number as your criteria in the COUNTIF function. In this example, I want to count only people of a certain age, so I put the age directly into the function.<\/p>\n<p>Notice that unlike a text string,\u00a0 you don\u2019t need to put quotation marks around a number in a formula.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/3.-Countif-number.png&#8221; alt=&#8221;countif excel 3&#8243; title_text=&#8221;3. Countif number&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Another thing I&#8217;ve done differently here is: I added two COUNTIF functions together. The reason for this is is that I want to count all the people aged 20 and 21.<\/p>\n<p>In order to do this, I use two separate COUNTIF functions. This may sound cumbersome, but the good news is that because COUNTIF just gives a final tally of cells that meet the criteria, you can use multiple COUNTIF functions in the same formula. You simply add them together to get the total count of all cells that match multiple criteria. You can also subtract COUNTIF functions when you want to get cells that are between two criteria.<\/p>\n<p>There\u2019s another way to use multiple criteria \u2013 I suggest you look into <a href=\"https:\/\/support.microsoft.com\/en-us\/office\/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842\" target=\"_blank\" rel=\"noopener noreferrer\">the COUNTIFS function<\/a> if you\u2019re interested in this!<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4>Criteria with logical operator<\/h4>\n<p>Logical operators such as &gt; and &lt; (greater than &amp; less than) can be used within your criteria.<\/p>\n<p>In the example below, I use the &lt; symbol to count all the people younger than 23 in my dataset, by typing <b>=COUNTIF(B2:B9,&#8221;&lt;23&#8243;)<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/4.-Countif-logical-operator.png&#8221; alt=&#8221;countif excel 4&#8243; title_text=&#8221;4. Countif logical operator&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Note that this criteria includes both the logical operator symbol and a number. The criteria must be enclosed in quotation marks, unlike when you use a number only.<\/p>\n<p>The following logical operators can be used in the same way:<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/5.-Logical-Operators.png&#8221; alt=&#8221;countif excel 5&#8243; title_text=&#8221;5. Logical Operators&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4>Concatenated criteria<\/h4>\n<p>You\u2019ve now seen the criteria part of the function as a text string, a number, and a cell reference.<\/p>\n<p>Let me show you how to do a combination of these by concatenating (combining) different criteria using the ampersand (&amp;). I do this below by typing <b>=COUNTIF(B2:B9,&#8221;&lt;&#8220;&amp;B7)<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/6.-Countif-Concatenate.png&#8221; alt=&#8221;countif excel 6&#8243; title_text=&#8221;6. Countif Concatenate&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>The result of this function is exactly the same as the previous example.<\/p>\n<p>Except, I have now used the &amp; symbol to concatenate a cell reference (B7) which contains the number 23, instead of simply typing the number 23 into the formula.<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4>Wildcards<\/h4>\n<p>On top of the different ways to set the criteria in the COUNTIF function, there is something else called &#8220;wildcards&#8221;.<\/p>\n<p>The wildcard characters * and ? can be used within your criteria to indicate a match with any character (?) or any sequence of characters (*).<\/p>\n<p>The example below has very specific criteria. I want to count all the occurrences of a 5-letter name that ends in \u201cy\u201d. To do this, you can use the ? wildcard.<\/p>\n<p>This wildcard character is a stand-in for any character \u2013 so when I type <b>=COUNTIF(A2:A9,&#8221;????y&#8221;)<\/b> I indicate that I want to count all instances where there are four characters (which can be anything) followed by a \u201cy\u201d.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/7.-Countif-name-example.png&#8221; alt=&#8221;countif excel 7&#8243; title_text=&#8221;7. Countif name example&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Use the second wilcard (*) when the length of the criteria doesn\u2019t matter \u2013 for instance, if I didn\u2019t care about the length of the name, just that it ended in \u201cy\u201d, the criteria could be \u201c*y\u201d.<\/p>\n<p>Another handy use for the * wildcard is to get rid of blank cells. I demonstrate that in the screenshot below using the formula <b>=COUNTIF(A2:A13,&#8221;*&#8221;)<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/8.-Countif-blank-cells.png&#8221; alt=&#8221;countif excel 8&#8243; title_text=&#8221;8. Countif blank cells&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Because the * represents any number of any characters, the only cells that don\u2019t meet this criteria are the ones that don\u2019t contain anything at all!<\/p>\n<h3>Countif Excel<\/h3>\n<p>By now, you hopefully have a good grasp on the many ways the Excel COUNTIF function can be used, and can put it into practice with your own data. Happy counting!<\/p>\n<p><span>If you\u2019d like to learn more about the various formulas of Google Sheets, why not take a look at our blog post on the <a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/dcount-formula-google-sheets\/\" target=\"_blank\" rel=\"noopener\">DCOUNT formula in Google Sheets.<\/a><\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A common task in Excel often involves taking a set of data and tallying the number of occurrences that match certain characteristics. The COUNTIF Excel function allows you to do just that: it counts the number of data points (cells) that meet a certain criteria that you specify within the function. Because of the wide [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":30746,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[65],"tags":[39,48,28],"class_list":["post-30744","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel-functions","tag-connections-t","tag-excel","tag-spreadsheets"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/30744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/comments?post=30744"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/30744\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media\/30746"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media?parent=30744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/categories?post=30744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/tags?post=30744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}