{"id":1167,"date":"2013-12-10T02:52:51","date_gmt":"2013-12-10T02:52:51","guid":{"rendered":"http:\/\/excelvbatutor.com\/?page_id=1167"},"modified":"2019-04-19T07:38:18","modified_gmt":"2019-04-19T07:38:18","slug":"excel-vba-2010-lesson-8-formatting-functions","status":"publish","type":"page","link":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/","title":{"rendered":"Excel 2010 VBA Lesson 8: Formatting Functions"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-7-mathematical-functions\/\">[Lesson 7]<\/a>&lt;&lt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-tutorial\/\">[Table of Contents]<\/a>&gt;&gt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-9-string-manipulation-functions\/\">[Lesson 9]<\/a><\/strong><\/h4>\n\n\n\n<p>Data in the previous lesson were presented fairly systematically through the use of functions like Int, Fix, and Round. However, the Format function improves&nbsp;the presentation of the numeric values. There are two types of Format function, one of them is the built-in format while another one is the user-defined function.<\/p>\n\n\n\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br><ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"9639157585\"><\/ins><br><script><br \/>\n     (adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>8.1 Predefined Format function<\/strong><\/h3>\n\n\n\n<p>The syntax of the predefined Format function is<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Format (n, \u201cstyle argument\u201d)\n<\/pre>\n\n\n\n<p>where n is a number and the list of style arguments are listed in Table 8.1<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>Table 8.1<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig8.11.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"322\" height=\"345\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig8.11.jpg\" alt=\"vba2010_fig8.1\" class=\"wp-image-1618\"\/><\/a><\/figure><\/div>\n\n\n\n<p>The output is shown in Figure 8.1<br><br><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br><ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"9639157585\"><\/ins><br><script><br \/>\n     (adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><br><strong>Figure 8.1<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8.2&nbsp;user-defined Format function<\/h3>\n\n\n\n<p>The syntax of the user-defined Format function is<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Format (n, \u201cuser\u2019s format\u201d)<\/strong>\n<\/pre>\n\n\n\n<p>Although it is known as user-defined format, we still need to follow certain formatting styles. Examples of user-defined formatting style are listed in Table 8.2<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.2.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>Table 8.2<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example 8.2<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">Private Sub CommandButton1_Click()\n Cells(1, 1) = Format(781234.57, \u201c0\u2033)\n Cells(2, 1) = Format(781234.57, \u201c0.0\u2033)\n Cells(3, 1) = Format(781234.576, \u201c0.00\u2033)\n Cells(4, 1) = Format(781234.576, \u201c#,##0.00\u2033)\n Cells(5, 1) = Format(781234.576, \u201c$#,##0.00\u2033)\n Cells(6, 1) = Format(0.576, \u201c0%\u201d)\n Cells(7, 1) = Format(0.5768, \u201c0.00%\u201d)\nEnd Sub\n<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig8.21.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"311\" height=\"360\" src=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/12\/vba2010_fig8.21.jpg\" alt=\"vba2010_fig8.2\" class=\"wp-image-1621\"\/><\/a><\/figure><\/div>\n\n\n\n<p>The output is shown in Figure 8.2<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Figure 8.2<\/h4>\n\n\n\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br><ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"9639157585\"><\/ins><br><script><br \/>\n     (adsbygoogle = window.adsbygoogle || []).push({});<br \/>\n<\/script><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-7-mathematical-functions\/\">[Lesson 7]<\/a>&lt;&lt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-tutorial\/\">[Table of Contents]<\/a>&gt;&gt;<a href=\"http:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-9-string-manipulation-functions\/\">[Lesson 9]<\/a><\/strong><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>[Lesson 7]&lt;&lt;[Table of Contents]&gt;&gt;[Lesson 9] Data in the previous lesson were presented fairly systematically through the use of functions like Int, Fix, and Round. However, the Format function improves&nbsp;the presentation of the numeric values. There are two types of Format function, one of them is the built-in format while another one is the user-defined function. &hellip; <a href=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Excel 2010 VBA Lesson 8: Formatting Functions&#8221;<\/span><\/a><\/p>\n","protected":false},"author":5012,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-1167","page","type-page","status-publish","hentry","category-function"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Excel 2010 VBA Lesson 8: Formatting Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor<\/title>\n<meta name=\"description\" content=\"This lesson illustrates the usage of formatting functions in Excel VBA 2010 programming\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Excel 2010 VBA Lesson 8: Formatting Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\" \/>\n<meta property=\"og:description\" content=\"This lesson illustrates the usage of formatting functions in Excel VBA 2010 programming\" \/>\n<meta property=\"og:url\" content=\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-19T07:38:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/\",\"url\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/\",\"name\":\"Excel 2010 VBA Lesson 8: Formatting Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\",\"isPartOf\":{\"@id\":\"https:\/\/excelvbatutor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg\",\"datePublished\":\"2013-12-10T02:52:51+00:00\",\"dateModified\":\"2019-04-19T07:38:18+00:00\",\"description\":\"This lesson illustrates the usage of formatting functions in Excel VBA 2010 programming\",\"breadcrumb\":{\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#primaryimage\",\"url\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg\",\"contentUrl\":\"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg\",\"width\":680,\"height\":469},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/excelvbatutor.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel 2010 VBA Lesson 8: Formatting Functions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/excelvbatutor.com\/#website\",\"url\":\"https:\/\/excelvbatutor.com\/\",\"name\":\"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor\",\"description\":\"Master Excel VBA with free tutorials, examples, and personalized guidance. Perfect for beginners and advanced users looking to automate Excel.\",\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Excel 2010 VBA Lesson 8: Formatting Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","description":"This lesson illustrates the usage of formatting functions in Excel VBA 2010 programming","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/","og_locale":"en_US","og_type":"article","og_title":"Excel 2010 VBA Lesson 8: Formatting Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","og_description":"This lesson illustrates the usage of formatting functions in Excel VBA 2010 programming","og_url":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/","og_site_name":"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","article_modified_time":"2019-04-19T07:38:18+00:00","og_image":[{"url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/","url":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/","name":"Excel 2010 VBA Lesson 8: Formatting Functions - Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","isPartOf":{"@id":"https:\/\/excelvbatutor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#primaryimage"},"image":{"@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg","datePublished":"2013-12-10T02:52:51+00:00","dateModified":"2019-04-19T07:38:18+00:00","description":"This lesson illustrates the usage of formatting functions in Excel VBA 2010 programming","breadcrumb":{"@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#primaryimage","url":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg","contentUrl":"https:\/\/excelvbatutor.com\/wp-content\/uploads\/2013\/02\/vba_table9.1.jpg","width":680,"height":469},{"@type":"BreadcrumbList","@id":"https:\/\/excelvbatutor.com\/index.php\/excel-vba-2010-lesson-8-formatting-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/excelvbatutor.com\/"},{"@type":"ListItem","position":2,"name":"Excel 2010 VBA Lesson 8: Formatting Functions"}]},{"@type":"WebSite","@id":"https:\/\/excelvbatutor.com\/#website","url":"https:\/\/excelvbatutor.com\/","name":"Learn Excel VBA Online \u2013 Step-by-Step Tutorials &amp; Courses | ExcelVBATutor","description":"Master Excel VBA with free tutorials, examples, and personalized guidance. Perfect for beginners and advanced users looking to automate Excel.","inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/1167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/users\/5012"}],"replies":[{"embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/comments?post=1167"}],"version-history":[{"count":38,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/1167\/revisions"}],"predecessor-version":[{"id":3320,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/pages\/1167\/revisions\/3320"}],"wp:attachment":[{"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/media?parent=1167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/categories?post=1167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelvbatutor.com\/index.php\/wp-json\/wp\/v2\/tags?post=1167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}