{"id":3289,"date":"2021-04-29T09:17:57","date_gmt":"2021-04-29T16:17:57","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3289"},"modified":"2021-04-29T09:17:58","modified_gmt":"2021-04-29T16:17:58","slug":"how-to-count-unique-values-in-excel-with-countif","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3289","title":{"rendered":"How to Count Unique Values in Excel &#8211; With COUNTIF"},"content":{"rendered":"\n<p>This example shows you how to create an array formula that&nbsp;<strong>counts unique values<\/strong>.<\/p>\n\n\n\n<p>1. We use the&nbsp;COUNTIF function. For example, to count the number of 5&#8217;s, use the following function.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/examples\/images\/count-unique-values\/countif-function.png\" alt=\"Countif Function\" title=\"Countif Function\"\/><\/figure>\n\n\n\n<p>2. To count the unique values (don&#8217;t be overwhelmed), we add the SUM function, 1\/, and replace 5 with A1:A6.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/examples\/images\/count-unique-values\/array-formula.png\" alt=\"Array Formula\" title=\"Array Formula\"\/><\/figure>\n\n\n\n<p>3. Finish by pressing CTRL + SHIFT + ENTER.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/examples\/images\/count-unique-values\/count-unique-values-result.png\" alt=\"Count Unique Values in Excel\" title=\"Count Unique Values in Excel\"\/><\/figure>\n\n\n\n<p>Note: The formula bar indicates that this is an array formula by enclosing it in curly braces {}. Do not type these yourself. They will disappear when you edit the formula.<\/p>\n\n\n\n<p>Explanation: The range (array constant) created by the&nbsp;COUNTIF function&nbsp;is stored in&nbsp;<strong>Excel&#8217;s<\/strong>&nbsp;memory, not in a range. The array constant looks as follows:<\/p>\n\n\n\n<p>{3;1;1;1;3;3} &#8211; (three 7&#8217;s, one sun, one moon, one 5, three 7&#8217;s, three 7&#8217;s)<\/p>\n\n\n\n<p>This reduces to:<br>{1\/3;1\/1;1\/1;1\/1;1\/3;1\/3}<\/p>\n\n\n\n<p>This array constant is used as an argument for the SUM function, giving a result of 1\/3+1+1+1+1\/3+1\/3 = 4.<\/p>\n\n\n\n<p>4. The array formula below counts the number of values that occur exactly once.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/examples\/images\/count-unique-values\/exactly-once.png\" alt=\"Exactly Once\" title=\"Exactly Once\"\/><\/figure>\n\n\n\n<p>5. If you have Excel 365, simply use the magic UNIQUE function to extract unique values.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/examples\/images\/count-unique-values\/unique-function.png\" alt=\"UNIQUE function\" title=\"UNIQUE function\"\/><\/figure>\n\n\n\n<p>Note: this dynamic array function, entered into cell C3, fills multiple cells. Wow! This behavior in Excel 365 is called spilling.<\/p>\n\n\n\n<p>6. Next, add the COUNTA function to count unique values in Excel 365.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/examples\/images\/count-unique-values\/counta-unique.png\" alt=\"COUNTA and UNIQUE\" title=\"COUNTA and UNIQUE\"\/><\/figure>\n\n\n\n<p>7. The formula below counts the number of values that occur exactly once.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.excel-easy.com\/examples\/images\/count-unique-values\/count-values-that-occur-exactly-once.png\" alt=\"Count Values that Occur Exactly Once\" title=\"Count Values that Occur Exactly Once\"\/><\/figure>\n\n\n\n<p>Note: the UNIQUE function has 2 optional arguments. The default value of 0 (second argument) tells the UNIQUE function to extract values from a vertical array. The value 1 (third argument) tells the UNIQUE function to extract values that occur exactly once.<\/p>\n\n\n\n<p>Ref: https:\/\/www.excel-easy.com\/examples\/count-unique-values.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This example shows you how to create an array formula that&nbsp;counts unique values. 1. We use the&nbsp;COUNTIF function. For example, to count the number of 5&#8217;s, use the following function. 2. To count the unique values (don&#8217;t be overwhelmed), we add the SUM function, 1\/, and replace 5 with A1:A6. 3. Finish by pressing CTRL <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3289\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,18],"tags":[],"class_list":["post-3289","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-microsoft-office"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3289"}],"version-history":[{"count":2,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3289\/revisions"}],"predecessor-version":[{"id":3291,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3289\/revisions\/3291"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}