{"id":243,"date":"2018-06-27T16:14:05","date_gmt":"2018-06-27T16:14:05","guid":{"rendered":"http:\/\/officetuts.net\/excel\/?p=243"},"modified":"2024-03-29T13:43:49","modified_gmt":"2024-03-29T13:43:49","slug":"remove-leading-zeros","status":"publish","type":"post","link":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/","title":{"rendered":"Remove Leading Zeros in Excel"},"content":{"rendered":"\n

When you have to work with a spreadsheet that you didn\u2019t create, sometimes you may encounter poorly formatted data or formatting errors.<\/p>\n\n\n\n

For example, you open a document, and instead of numbers, you have text values with leading zeros.<\/p>\n\n\n\n

Formatting text to numbers<\/a> won\u2019t work because it will keep zeros at the beginning of the value.<\/p>\n\n\n\n

Remove leading zeros and treat values as numbers<\/h2>\n\n\n\n

Take a look at the following formula.<\/p>\n\n\n\n

=VALUE(A1)<\/pre>\n\n\n\n

It will convert data into a number and strip zeros in the process.<\/p>\n\n\n\n

Take the following data and use it to find out how this function works.<\/p>\n\n\n\n

1001001<\/strong><\/p>\n\n\n\n

0100010<\/strong><\/p>\n\n\n\n

0000001<\/strong><\/p>\n\n\n\n

0001000<\/strong><\/p>\n\n\n\n

1000000<\/strong><\/p>\n\n\n\n

This will return the following result.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

CAUTION<\/h4>\n\n\n\n

When you use somebody else\u2019s worksheet you never know what type of characters there are. Not all of them are printable, so instead of using the =VALUE(A1)<\/strong> function only use =VALUE(TRIM(CLEAN(A1)))<\/strong> to be sure that any unwanted character is not present on your worksheet.<\/p>\n\n\n\n

Remove leading zeros and keep values as text<\/h2>\n\n\n\n

If you want to keep values as text, use the following formula.<\/p>\n\n\n\n

=TEXT(VALUE(A1),\"#\")<\/pre>\n\n\n\n

First, it will convert a value to a number in order to delete leading zeros and then it converts it to text with the formatting set in the second argument (#)<\/strong>.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

As you can see the result is the same as in the previous example, with the difference that this time the values are aligned to left<\/a> (default for text).<\/p>\n\n\n\n

Delete leading zeros from non-numeric values<\/h2>\n\n\n\n

The above examples work perfectly as long as we deal with values that can be converted to numbers.<\/p>\n\n\n\n

The situation changes when we have numbers mixed with text.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Only the first value is converted correctly, the next cells return the #VALUE<\/a> error.<\/p>\n\n\n\n

To deal with this problem, you have to use a bit more complicated formula.<\/p>\n\n\n\n

Take a look.<\/p>\n\n\n\n

=RIGHT(A2,LEN(A2)-FIND(LEFT(SUBSTITUTE(A2&\" \",\"0\",\"\"),1),A2)+1)<\/pre>\n\n\n\n

Let\u2019s analyze it piece by piece.<\/p>\n\n\n\n

=RIGHT(A2,LEN(A2)-FIND(LEFT(SUBSTITUTE(A2&\" \",\"0\",\"\"),1),A2)+1)<\/pre>\n\n\n\n

This part of the formula will replace all zeros with nothing. This will give us the following result.<\/p>\n\n\n\n

=RIGHT(A2,LEN(A2)-FIND(LEFT(SUBSTITUTE(A2&\" \",\"0\",\"\"),1),A2)+1)<\/pre>\n\n\n\n

The LEFT<\/strong> function returns the specified number of characters, starting from the beginning of the string.<\/p>\n\n\n\n

In this example, it will return the first character of each string.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n
=RIGHT(A2,LEN(A2)-FIND(LEFT(SUBSTITUTE(A2&\" \",\"0\",\"\"),1),A2)+1)<\/pre>\n\n\n\n

The LEN<\/strong> function will return the length of the string.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n
=RIGHT(A2,LEN(A2)-FIND(LEFT(SUBSTITUTE(A2&\" \",\"0\",\"\"),1),A2)+1)<\/pre>\n\n\n\n

The FIND<\/strong> function returns the first position of the character in the string.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

The last function is RIGHT.<\/strong> It returns the specified number of characters from the right side of the string.<\/p>\n\n\n\n

=RIGHT(A2,(9-7)+1)<\/pre>\n\n\n\n

returns 532.<\/strong><\/p>\n\n\n\n

This is the final result.<\/p>\n\n\n\n

\"\"<\/figure>\n","protected":false},"excerpt":{"rendered":"

When you have to work with a spreadsheet that you didn\u2019t create, sometimes you may encounter poorly formatted data or formatting errors. For…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[190],"yoast_head":"\nRemove Leading Zeros in Excel<\/title>\n<meta name=\"description\" content=\"Learn how to remove leading zeros from text values when working with poorly formatted data in Excel. Use the =VALUE function or =VALUE(TRIM(CLEAN(A1))) to ensure all unwanted characters are removed.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Remove Leading Zeros in Excel\" \/>\n<meta property=\"og:description\" content=\"Learn how to remove leading zeros from text values when working with poorly formatted data in Excel. Use the =VALUE function or =VALUE(TRIM(CLEAN(A1))) to ensure all unwanted characters are removed.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-06-27T16:14:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-29T13:43:49+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png\" \/>\n<meta name=\"author\" content=\"Tomasz Decker\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tomasz Decker\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/\"},\"author\":{\"name\":\"Tomasz Decker\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"headline\":\"Remove Leading Zeros in Excel\",\"datePublished\":\"2018-06-27T16:14:05+00:00\",\"dateModified\":\"2024-03-29T13:43:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/\"},\"wordCount\":425,\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png\",\"keywords\":[\"pinterest\"],\"articleSection\":[\"formulas\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/\",\"url\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/\",\"name\":\"Remove Leading Zeros in Excel\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png\",\"datePublished\":\"2018-06-27T16:14:05+00:00\",\"dateModified\":\"2024-03-29T13:43:49+00:00\",\"description\":\"Learn how to remove leading zeros from text values when working with poorly formatted data in Excel. Use the =VALUE function or =VALUE(TRIM(CLEAN(A1))) to ensure all unwanted characters are removed.\",\"breadcrumb\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage\",\"url\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png\",\"contentUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/officetuts.net\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Remove Leading Zeros in Excel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/officetuts.net\/excel\/#website\",\"url\":\"https:\/\/officetuts.net\/excel\/\",\"name\":\"\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/officetuts.net\/excel\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\",\"name\":\"Tomasz Decker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"caption\":\"Tomasz Decker\"},\"logo\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\"},\"description\":\"Spreadsheet and Python enthusiast.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Remove Leading Zeros in Excel","description":"Learn how to remove leading zeros from text values when working with poorly formatted data in Excel. Use the =VALUE function or =VALUE(TRIM(CLEAN(A1))) to ensure all unwanted characters are removed.","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:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/","og_locale":"en_US","og_type":"article","og_title":"Remove Leading Zeros in Excel","og_description":"Learn how to remove leading zeros from text values when working with poorly formatted data in Excel. Use the =VALUE function or =VALUE(TRIM(CLEAN(A1))) to ensure all unwanted characters are removed.","og_url":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/","article_published_time":"2018-06-27T16:14:05+00:00","article_modified_time":"2024-03-29T13:43:49+00:00","og_image":[{"url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png"}],"author":"Tomasz Decker","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tomasz Decker","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#article","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/"},"author":{"name":"Tomasz Decker","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"headline":"Remove Leading Zeros in Excel","datePublished":"2018-06-27T16:14:05+00:00","dateModified":"2024-03-29T13:43:49+00:00","mainEntityOfPage":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/"},"wordCount":425,"publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"image":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png","keywords":["pinterest"],"articleSection":["formulas"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/","url":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/","name":"Remove Leading Zeros in Excel","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage"},"image":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png","datePublished":"2018-06-27T16:14:05+00:00","dateModified":"2024-03-29T13:43:49+00:00","description":"Learn how to remove leading zeros from text values when working with poorly formatted data in Excel. Use the =VALUE function or =VALUE(TRIM(CLEAN(A1))) to ensure all unwanted characters are removed.","breadcrumb":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#primaryimage","url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png","contentUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2018\/06\/value-example.png"},{"@type":"BreadcrumbList","@id":"https:\/\/officetuts.net\/excel\/formulas\/remove-leading-zeros\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/officetuts.net\/excel\/"},{"@type":"ListItem","position":2,"name":"Remove Leading Zeros in Excel"}]},{"@type":"WebSite","@id":"https:\/\/officetuts.net\/excel\/#website","url":"https:\/\/officetuts.net\/excel\/","name":"","description":"","publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/officetuts.net\/excel\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42","name":"Tomasz Decker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","caption":"Tomasz Decker"},"logo":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/"},"description":"Spreadsheet and Python enthusiast."}]}},"_links":{"self":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/243"}],"collection":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/comments?post=243"}],"version-history":[{"count":9,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":17385,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/243\/revisions\/17385"}],"wp:attachment":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/media?parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/categories?post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/tags?post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}