{"id":907,"date":"2015-03-22T23:00:38","date_gmt":"2015-03-22T14:00:38","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=907"},"modified":"2015-03-22T23:00:38","modified_gmt":"2015-03-22T14:00:38","slug":"conditional_branch_if","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/conditional_branch_if\/","title":{"rendered":"\u6761\u4ef6\u5206\u5c90 If\u6587\uff08If&#8230;Then&#8230;Else \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\uff09"},"content":{"rendered":"<h2>If&#8230;Then&#8230;Else \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u3044\u65b9<\/h2>\n<br \/>\n<div class=\"m30-l\">\n<div class=\"kkbox\"><strong>\u3010\u69cb\u6587\uff1a\u5358\u4e00\u884c\u5f62\u5f0f\u3011<\/strong><br \/>\n<strong>If<\/strong> <em>condition<\/em> <strong>Then<\/strong> [ <em>statements<\/em> ][ <strong>Else<\/strong> <em>else_statements<\/em> ]\n<\/div>\n<p><\/p>\n<div class=\"kkbox\"><strong>\u3010\u69cb\u6587\uff1a\u30d6\u30ed\u30c3\u30af\u5f62\u5f0f\u3011<\/strong><br \/>\n<strong>If<\/strong> <em>condition<\/em> <strong>Then<\/strong><br \/>\n\u3000\u3000<em>statements<\/em><\/p>\n<p>[ <strong>ElseIf<\/strong> <em>condition1<\/em> <strong>Then<\/strong> ]<br \/>\n\u3000\u3000<em>[ else_if_statements1<\/em> ]<\/p>\n<p>[ <strong>ElseIf<\/strong> <em>condition2<\/em> <strong>Then<\/strong> ]<br \/>\n\u3000\u3000<em>[ else_if_statements2<\/em> ]<\/p>\n<p>[ \u30fb\u30fb\u30fb\u30fb\u30fb ]<\/p>\n<p>[ <strong>Else<\/strong> ]<br \/>\n\u3000\u3000<em>[ else_statements<\/em> ]<\/p>\n<p><strong>End<\/strong> <strong>If<\/strong>\n<\/div>\n<h3>\u3010\u9805\u76ee\u306e\u8aac\u660e\u3011<\/h3>\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>condition&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;&nbsp;&nbsp;\u771f\uff08True\uff09\u304b\u507d\uff08False\uff09\u3092\u8a55\u4fa1\u3059\u308b\u6761\u4ef6\u5f0f\uff08\u6570\u5f0f\u30fb\u6587\u5b57\u5217\u5f0f\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>statements&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;<em>condition<\/em> \u304c\u771f\uff08true\uff09\u306e\u5834\u5408\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br \/>\u300c\u30d6\u30ed\u30c3\u30af\u5f62\u5f0f\u300d\u306e\u5834\u5408\u306f\u7701\u7565\u53ef\u3001\u300c\u5358\u4e00\u884c\u5f62\u5f0f\u300d\u306e\u5834\u5408\u306f\u5fc5\u305a\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>else_statements&nbsp;\u30fb\u30fb\u30fb&nbsp;Else \u4ee5\u524d\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u6761\u4ef6\u304c\u3069\u308c\u3082\u771f\uff08True\uff09\u3067\u306a\u3044\u3068\u304d\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\uff08\u7701\u7565\u53ef\uff09<\/li>\n<li>conditon1(2)&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;\u771f\uff08True\uff09\u304b\u507d\uff08False\uff09\u3092\u8a55\u4fa1\u3059\u308b\u6761\u4ef6\u5f0f\uff08\u6570\u5f0f\u30fb\u6587\u5b57\u5217\u5f0f\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\uff08\u7701\u7565\u53ef\uff09<\/li>\n<li>else_if_statements1(2)&nbsp;\u30fb\u30fb\u30fb&nbsp;<em>condition1(2)<\/em>\u304c\u771f\uff08True\uff09\u306e\u3068\u304d\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\uff08\u7701\u7565\u53ef\uff09<\/li>\n<\/ul>\n<\/div>\n<br \/><br \/>\n<h2>If&#8230;Then&#8230;Else \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3>VBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"If...Then...Else \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\n\u3000\r\nSub Sample_if_statement_1()\r\n\r\n\u3000'\u5358\u4e00\u884c\u5f62\u5f0f\r\n\r\n    Dim Number As Integer\r\n\r\n    Number = 252\r\n\r\n    If Number > 100 Then MsgBox (\"100\u3088\u308a\u5927\u304d\u3044\") Else MsgBox (\"100\u672a\u6e80\")\r\n    \r\nEnd Sub\r\n\r\n\r\nSub Sample_if_statement_2()\r\n\u3000'\u30d6\u30ed\u30c3\u30af\u5f62\u5f0f\r\n\r\n\u3000\u3000Dim Number As Integer\r\n\r\n    Number = 125\r\n\r\n    If Number > 0 Then\r\n        MsgBox Number & \" \u306f\u3001\u6b63\u6570\u3067\u3059\"\r\n    \r\n    ElseIf Number < 0 Then\r\n        MsgBox Number &#038; \" \u306f\u3001\u8ca0\u6570\u3067\u3059\"\r\n        \r\n    Else\r\n        MsgBox Number &#038; \" \u3067\u3059\"\r\n    \r\n    End If\r\n    \r\nEnd Sub\r\n\u3000\r\n<\/pre>\n<p><\/p>\n<h3>If...Then...Else \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u30de\u30af\u30ed\u5b9f\u884c\u4f8b<\/h3>\n<p>Sub Sample_if_statement_1()\u306e\u5b9f\u884c\u4f8b<br \/>\n<a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/if01.jpg?ssl=1\" rel=\"lightbox[907]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/if01.jpg?resize=154%2C178&#038;ssl=1\" alt=\"If\u6587\u4f7f\u7528\u4f8b\u305d\u306e\uff11\" width=\"154\" height=\"178\" class=\"alignnone size-full wp-image-931\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p>Sub Sample_if_statement_2()\u306e\u5b9f\u884c\u4f8b<br \/>\n<a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/if02.jpg?ssl=1\" rel=\"lightbox[907]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/if02.jpg?resize=163%2C178&#038;ssl=1\" alt=\"If\u6587\u4f7f\u7528\u4f8b\u305d\u306e\uff12\" width=\"163\" height=\"178\" class=\"alignnone size-full wp-image-932\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/><\/div>\n<br \/>\n","protected":false},"excerpt":{"rendered":"<p>If&#8230;Then&#8230;Else \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u3044\u65b9 \u3010\u69cb\u6587 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":931,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":"\u30d6\u30ed\u30b0\u3092\u66f4\u65b0\u3057\u307e\u3057\u305f http:\/\/wp.me\/p4Ye9i-eD"},"categories":[48],"tags":[51,50,38,49],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/03\/if01.jpg?fit=154%2C178&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-eD","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/907"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=907"}],"version-history":[{"count":18,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/907\/revisions"}],"predecessor-version":[{"id":933,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/907\/revisions\/933"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/931"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}