{"id":15086,"date":"2018-08-07T22:31:29","date_gmt":"2018-08-08T02:31:29","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=15086"},"modified":"2024-10-25T10:16:41","modified_gmt":"2024-10-25T14:16:41","slug":"using-si-prefixes-multipliers-in-spreadsheets","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2018\/08\/07\/using-si-prefixes-multipliers-in-spreadsheets\/","title":{"rendered":"Using SI prefixes\/multipliers in spreadsheets"},"content":{"rendered":"\n<p><strong>Note:<\/strong> I&#8217;ve lightly tested this with <strong>Microsoft Excel<\/strong> (Windows 10), <strong>Excel Online<\/strong>, <strong>Google Sheets<\/strong> and <strong>LibreOffice Calc<\/strong>. It <em>seems<\/em> to work. Like all spreadsheet data conversions, please verify before trusting your PhD thesis tables to it \u2026<\/p>\n\n\n\n<p>Asked on the GTALUG mailing list the other week:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Does anybody know how to display and work with SI numbers like 10k or 20M or 40G within LibreOffice?<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-preformatted\">I came up with the following formula, in this example for data in cell D3:<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">=IF(LEN(T(D3))=0, D3, CONVERT(VALUE(LEFT(D3, LEN(D3) - 1)),\n    RIGHT(D3, 1) &amp; \"m\", \"m\"))<\/pre>\n\n\n\n<p>which results in:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><b><span style=\"font-family: Calibri; font-size: medium;\">Input<\/span><\/b><\/td><td><b><span style=\"font-family: Calibri; font-size: medium;\">Value<\/span><\/b><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">1u<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">1.00E-06<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">10u<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">10.00E-06<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">100u<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">100.00E-06<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">1m<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">1.00E-03<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">10m<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">10.00E-03<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">100m<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">100.00E-03<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">1<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">1.00E+00<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">10<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">10.00E+00<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">100<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">100.00E+00<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">1k<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">1.00E+03<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">10k<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">10.00E+03<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">100k<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">100.00E+03<\/span><\/td><\/tr><tr><td><span style=\"font-family: Calibri; font-size: medium;\">1M<\/span><\/td><td><span style=\"font-family: Calibri; font-size: medium;\">1.00E+06<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The right column is displayed in LibreOffice Calc&#8217;s newly(ish)-supported engineering notation.<\/p>\n\n\n\n<p>This function works through creative (mis-)use of the <code>CONVERT()<\/code> function:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>if the argument is a numeric value, pass it through;<\/li>\n\n\n\n<li>if the argument is a string, return <code>CONVERT(\u00abnumeric part\u00bb, \"\u00abprefix\u00bbm\", \"m\")<\/code>. This is lightly <del>misusing<\/del> overloading the unit conversion function by going via metres, but it saves having a lookup table.<\/li>\n<\/ol>\n\n\n\n<p>This function doesn&#8217;t work with IEC 60027-2 binary prefixes, but they&#8217;re silly and I wouldn&#8217;t be caught dead using &#8217;em.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: I&#8217;ve lightly tested this with Microsoft Excel (Windows 10), Excel Online, Google Sheets and LibreOffice Calc. It seems to work. Like all spreadsheet data conversions, please verify before trusting your PhD thesis tables to it \u2026 Asked on the GTALUG mailing list the other week: Does anybody know how to display and work with [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[1739,3144,726],"class_list":["post-15086","post","type-post","status-publish","format-standard","hentry","category-computers-suck","tag-data","tag-si","tag-spreadsheet"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-3Vk","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/15086","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=15086"}],"version-history":[{"count":4,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/15086\/revisions"}],"predecessor-version":[{"id":17663,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/15086\/revisions\/17663"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=15086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=15086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=15086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}