{"id":100,"date":"2024-12-11T06:51:46","date_gmt":"2024-12-10T22:51:46","guid":{"rendered":"https:\/\/lilia-study.com\/lang\/eng\/?p=100"},"modified":"2024-12-11T06:51:46","modified_gmt":"2024-12-10T22:51:46","slug":"countif","status":"publish","type":"post","link":"https:\/\/lilia-study.com\/lang\/chs\/excel\/excel-vba\/worksheetfunction\/countif\/","title":{"rendered":"Excel VBA \u67e5\u627e\u4e0e\u641c\u7d22\u6761\u4ef6\u5339\u914d\u7684\u6b21\u6570-CountIf"},"content":{"rendered":"<p><!-- wp:html --><\/p>\n<p><span class=\"icon_point color01\"><\/span>&nbsp;\u672c\u6587\u7531\u65e5\u6587\u8bd1\u6210\u4e2d\u6587\u3002<\/p>\n<p><!-- \/wp:html --><\/p>\n\n\n\n\n<p>\u672c\u6587\u8bb0\u5f55\u4e86\u5982\u4f55\u5728 Excel VBA \u4e2d\u67e5\u627e\u7b26\u5408\u641c\u7d22\u6761\u4ef6\u7684\u5355\u5143\u683c\u6570\u3002<\/p>\n\n\n\n<p>\u8981\u8ba1\u7b97\u7b26\u5408\u641c\u7d22\u6761\u4ef6\u7684\u5355\u5143\u683c\u6570\uff0c\u8bf7\u4f7f\u7528\u5de5\u4f5c\u8868\u51fd\u6570 \u201cCountIf\u201d\u3002<\/p>\n\n\n<p><!-- wp:html --><\/p>\n<p style=\"margin-bottom:0;padding-bottom:0;\">&lt;&nbsp;Sponsored Links&nbsp;&gt;<\/p>\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<!-- lilia top --><br \/>\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-4504956686889525\" data-ad-slot=\"2727563599\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins><br \/>\n<script>\n(adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><br \/>\n<!-- \/wp:html --><\/p>\n\n\n\n\n<h2 class=\"wp-block-heading\">\u53e5\u6cd5 &#8220;CountIf&#8221;<\/h2>\n\n\n\n<div class=\"box_style box_style_orange\">\n<div class=\"box_inner\">\n<p class=\"b big\">WorksheetFunction.CountIf(Arg1, Arg2)<\/p>\n<\/div>\n<\/div>\n\n\n\n<p>Arg1 = \u5fc5\u9700\u3002\u6570\u636e\u7c7b\u578b\u4e3a Range\uff0c\u6307\u5b9a\u8981\u67e5\u627e\u5355\u5143\u683c\u6570\u7684\u5355\u5143\u683c\u533a\u57df\u3002<br>Arg2 = \u5fc5\u586b\uff0c\u6570\u636e\u7c7b\u578b\u4e3a\u53d8\u91cf\u3002\u6570\u636e\u7c7b\u578b\u4e3a\u53d8\u91cf\uff0c\u4ee5\u6570\u5b57\u3001\u8868\u8fbe\u5f0f\u3001\u5355\u5143\u683c\u5f15\u7528\u6216\u5b57\u7b26\u4e32\u7684\u5f62\u5f0f\u6307\u5b9a\u5b9a\u4e49\u8981\u8fdb\u884c\u8ba1\u7b97\u7684\u5355\u5143\u683c\u7684\u6761\u4ef6\u3002\u4f8b\u5982\uff0c\u641c\u7d22\u6761\u4ef6\u53ef\u4ee5\u662f 32\u3001\u201c32\u201d\u3001\u201cWindows \u201d\u6216 B4\u3002(\u8868\u8fbe\u5f0f\u548c\u5b57\u7b26\u4e32\u5fc5\u987b\u7528\u5355\u5b57\u8282\u53cc\u5f15\u53f7\uff08&#8221;\uff09\u62ec\u8d77\u6765\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u53cc\u7cbe\u5ea6\u6d6e\u70b9\u6570\u503c\uff08Double\uff09\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u6307\u5b9a\u8303\u56f4\u5185\u7b26\u5408\u641c\u7d22\u6761\u4ef6\u7684\u5355\u5143\u683c\u6570\u3002<\/p>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u67e5\u627e\u4e0e\u641c\u7d22\u6761\u4ef6\u5339\u914d\u7684\u6b21\u6570\u793a\u4f8b<\/h2>\n\n\n\n<p>\u8ba1\u7b97 D \u5217\u4e2d\u5305\u542b \u201c\u4eba\u201d \u5b57\u7684\u5355\u5143\u683c\uff0c\u5e76\u5c06\u5176\u663e\u793a\u5728\u4e00\u6761\u4fe1\u606f\u4e2d\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro m30-b\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"Sub test()\n  MsgBox WorksheetFunction.CountIf(ActiveSheet.Range(&quot;D:D&quot;), &quot;\u4eba&quot;)\nEnd Sub\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">Sub<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">test<\/span><span style=\"color: #ECEFF4\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #88C0D0\">MsgBox<\/span><span style=\"color: #D8DEE9FF\"> WorksheetFunction.<\/span><span style=\"color: #88C0D0\">CountIf<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">ActiveSheet.<\/span><span style=\"color: #88C0D0\">Range<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">D:D<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">, <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\u4eba<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">End Sub<\/span><\/span><\/code><\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/10\/countif01.png\" alt=\"countif\" class=\"wp-image-1067\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/10\/countif02.png\" alt=\"countif\" class=\"wp-image-1068\"\/><\/figure>\n<\/div>\n\n\n<p>\u3000<\/p>\n\n\n\n<p>\u8ba1\u7b97 E \u680f\u4e2d \u201c35 \u5c81\u6216\u4ee5\u4e0a \u201d\u7684\u5355\u5143\u683c\uff0c\u5e76\u7528\u4fe1\u606f\u663e\u793a\u51fa\u6765\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro m30-b\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"Sub test()\n  MsgBox WorksheetFunction.CountIf(ActiveSheet.Range(&quot;E:E&quot;), &quot;&gt;=35&quot;)\nEnd Sub\" style=\"color:#d8dee9ff;display:none\" aria-label=\"\u590d\u5236\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">Sub<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">test<\/span><span style=\"color: #ECEFF4\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #88C0D0\">MsgBox<\/span><span style=\"color: #D8DEE9FF\"> WorksheetFunction.<\/span><span style=\"color: #88C0D0\">CountIf<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #D8DEE9FF\">ActiveSheet.<\/span><span style=\"color: #88C0D0\">Range<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">E:E<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\">, <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">&gt;=35<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #ECEFF4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">End Sub<\/span><\/span><\/code><\/pre><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/10\/countif03.png\" alt=\"countif\" class=\"wp-image-1069\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/10\/countif04.png\" alt=\"countif\" class=\"wp-image-1070\"\/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n<p><!-- wp:html --><\/p>\n<p style=\"margin-bottom:0;padding-bottom:0;\">&lt;&nbsp;Sponsored Links&nbsp;&gt;<\/p>\n<p><script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-4504956686889525\"\n     crossorigin=\"anonymous\"><\/script><br \/>\n<!-- lilia bottom --><br \/>\n<ins class=\"adsbygoogle\"\n     style=\"display:inline-block;width:336px;height:280px\"\n     data-ad-client=\"ca-pub-4504956686889525\"\n     data-ad-slot=\"7848928897\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><br \/>\n<!-- \/wp:html --><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u8bb0\u5f55\u4e86\u5982\u4f55\u5728 Excel VBA \u4e2d\u67e5\u627e\u7b26\u5408\u641c\u7d22\u6761\u4ef6\u7684\u5355\u5143\u683c\u6570\u3002 \u8981\u8ba1\u7b97\u7b26\u5408\u641c\u7d22\u6761\u4ef6\u7684\u5355\u5143\u683c\u6570\uff0c\u8bf7\u4f7f\u7528\u5de5\u4f5c\u8868\u51fd\u6570 \u201cCountIf\u201d\u3002 \u53e5\u6cd5 &#8220;CountIf&#8221; WorksheetFuncti [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2,8],"tags":[],"class_list":{"0":"post-100","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-excel","7":"category-excel-vba","8":"category-worksheetfunction"},"_links":{"self":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":0,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"wp:attachment":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}