Remove leading space from columns










1















I have a spreadsheet with ( 99| 100) in the first cell(A2).



Using =(split(A2," ( | ) ",true)) in cell B2 I am getting 99 and using =CONTINUE(A2, 1, 2) i am getting 100 in cell C2.



There is a leading space in both B2 and C2 how do i remove it, i need to perform a few calculations on B2 and C2.



I've tried using trim but it isn't working.



=trim(split(B248," ( | ) ",true))



For testing purposes i have the following code in cell D2 value(B2) and i get the error Cannot parse text



https://docs.google.com/spreadsheet/ccc?key=0AmZqKT8_r5b_dDJxSnh2Y09ndzhGWm10clp0TXpYT3c&usp=sharing










share|improve this question




























    1















    I have a spreadsheet with ( 99| 100) in the first cell(A2).



    Using =(split(A2," ( | ) ",true)) in cell B2 I am getting 99 and using =CONTINUE(A2, 1, 2) i am getting 100 in cell C2.



    There is a leading space in both B2 and C2 how do i remove it, i need to perform a few calculations on B2 and C2.



    I've tried using trim but it isn't working.



    =trim(split(B248," ( | ) ",true))



    For testing purposes i have the following code in cell D2 value(B2) and i get the error Cannot parse text



    https://docs.google.com/spreadsheet/ccc?key=0AmZqKT8_r5b_dDJxSnh2Y09ndzhGWm10clp0TXpYT3c&usp=sharing










    share|improve this question


























      1












      1








      1


      1






      I have a spreadsheet with ( 99| 100) in the first cell(A2).



      Using =(split(A2," ( | ) ",true)) in cell B2 I am getting 99 and using =CONTINUE(A2, 1, 2) i am getting 100 in cell C2.



      There is a leading space in both B2 and C2 how do i remove it, i need to perform a few calculations on B2 and C2.



      I've tried using trim but it isn't working.



      =trim(split(B248," ( | ) ",true))



      For testing purposes i have the following code in cell D2 value(B2) and i get the error Cannot parse text



      https://docs.google.com/spreadsheet/ccc?key=0AmZqKT8_r5b_dDJxSnh2Y09ndzhGWm10clp0TXpYT3c&usp=sharing










      share|improve this question
















      I have a spreadsheet with ( 99| 100) in the first cell(A2).



      Using =(split(A2," ( | ) ",true)) in cell B2 I am getting 99 and using =CONTINUE(A2, 1, 2) i am getting 100 in cell C2.



      There is a leading space in both B2 and C2 how do i remove it, i need to perform a few calculations on B2 and C2.



      I've tried using trim but it isn't working.



      =trim(split(B248," ( | ) ",true))



      For testing purposes i have the following code in cell D2 value(B2) and i get the error Cannot parse text



      https://docs.google.com/spreadsheet/ccc?key=0AmZqKT8_r5b_dDJxSnh2Y09ndzhGWm10clp0TXpYT3c&usp=sharing







      google-sheets






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 5:02









      Cœur

      17.5k9104145




      17.5k9104145










      asked Sep 3 '13 at 15:58









      debaldebal

      3934827




      3934827






















          2 Answers
          2






          active

          oldest

          votes


















          2














          I've tried to use the REGEXREPLACE function to get rid off the white spaces. It turns out that the ASCII character 160 isn't considered to be a white space but a “Non-breaking space”.



          Therefore I used the CODE function to reveal the empty space (remove the open bracket first). For your particular setting, the following will work:



          =SPLIT(SUBSTITUTE(B1,CHAR(160),""),"(|)")





          share|improve this answer




















          • 1





            Jacob, that works, but please could you explain what was I doing wrong there and how you went about it?

            – debal
            Sep 4 '13 at 14:36






          • 1





            @debal See my revised answer.

            – Jacob Jan Tuinstra
            Sep 5 '13 at 12:25


















          1














          I did a quick test and was able to get A2 and B2 to add without a problem. Please see:



          https://docs.google.com/spreadsheet/ccc?key=0AvRseCY0-3SVdEJybVU5U1pZYzdxX3NzNEVOekxFOVE&usp=sharing



          Perhaps there is some column formatting on your values?






          share|improve this answer























          • please check the sheet that i pasted

            – debal
            Sep 3 '13 at 16:15











          • I just noticed that the space in your first example is actually a non-breaking space (fileformat.info/info/unicode/char/a0/index.htm), not a standard space (fileformat.info/info/unicode/char/0020/index.htm).

            – bakercp
            Sep 4 '13 at 3:07











          • I tried several regex-based solutions and Jacob's is the best I've found.

            – bakercp
            Sep 4 '13 at 3:32











          • @bakercp tried that myself as well, haha, without success

            – Jacob Jan Tuinstra
            Sep 4 '13 at 8:06










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18596651%2fremove-leading-space-from-columns%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          I've tried to use the REGEXREPLACE function to get rid off the white spaces. It turns out that the ASCII character 160 isn't considered to be a white space but a “Non-breaking space”.



          Therefore I used the CODE function to reveal the empty space (remove the open bracket first). For your particular setting, the following will work:



          =SPLIT(SUBSTITUTE(B1,CHAR(160),""),"(|)")





          share|improve this answer




















          • 1





            Jacob, that works, but please could you explain what was I doing wrong there and how you went about it?

            – debal
            Sep 4 '13 at 14:36






          • 1





            @debal See my revised answer.

            – Jacob Jan Tuinstra
            Sep 5 '13 at 12:25















          2














          I've tried to use the REGEXREPLACE function to get rid off the white spaces. It turns out that the ASCII character 160 isn't considered to be a white space but a “Non-breaking space”.



          Therefore I used the CODE function to reveal the empty space (remove the open bracket first). For your particular setting, the following will work:



          =SPLIT(SUBSTITUTE(B1,CHAR(160),""),"(|)")





          share|improve this answer




















          • 1





            Jacob, that works, but please could you explain what was I doing wrong there and how you went about it?

            – debal
            Sep 4 '13 at 14:36






          • 1





            @debal See my revised answer.

            – Jacob Jan Tuinstra
            Sep 5 '13 at 12:25













          2












          2








          2







          I've tried to use the REGEXREPLACE function to get rid off the white spaces. It turns out that the ASCII character 160 isn't considered to be a white space but a “Non-breaking space”.



          Therefore I used the CODE function to reveal the empty space (remove the open bracket first). For your particular setting, the following will work:



          =SPLIT(SUBSTITUTE(B1,CHAR(160),""),"(|)")





          share|improve this answer















          I've tried to use the REGEXREPLACE function to get rid off the white spaces. It turns out that the ASCII character 160 isn't considered to be a white space but a “Non-breaking space”.



          Therefore I used the CODE function to reveal the empty space (remove the open bracket first). For your particular setting, the following will work:



          =SPLIT(SUBSTITUTE(B1,CHAR(160),""),"(|)")






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 5 '13 at 12:35

























          answered Sep 3 '13 at 20:02









          Jacob Jan TuinstraJacob Jan Tuinstra

          89111539




          89111539







          • 1





            Jacob, that works, but please could you explain what was I doing wrong there and how you went about it?

            – debal
            Sep 4 '13 at 14:36






          • 1





            @debal See my revised answer.

            – Jacob Jan Tuinstra
            Sep 5 '13 at 12:25












          • 1





            Jacob, that works, but please could you explain what was I doing wrong there and how you went about it?

            – debal
            Sep 4 '13 at 14:36






          • 1





            @debal See my revised answer.

            – Jacob Jan Tuinstra
            Sep 5 '13 at 12:25







          1




          1





          Jacob, that works, but please could you explain what was I doing wrong there and how you went about it?

          – debal
          Sep 4 '13 at 14:36





          Jacob, that works, but please could you explain what was I doing wrong there and how you went about it?

          – debal
          Sep 4 '13 at 14:36




          1




          1





          @debal See my revised answer.

          – Jacob Jan Tuinstra
          Sep 5 '13 at 12:25





          @debal See my revised answer.

          – Jacob Jan Tuinstra
          Sep 5 '13 at 12:25













          1














          I did a quick test and was able to get A2 and B2 to add without a problem. Please see:



          https://docs.google.com/spreadsheet/ccc?key=0AvRseCY0-3SVdEJybVU5U1pZYzdxX3NzNEVOekxFOVE&usp=sharing



          Perhaps there is some column formatting on your values?






          share|improve this answer























          • please check the sheet that i pasted

            – debal
            Sep 3 '13 at 16:15











          • I just noticed that the space in your first example is actually a non-breaking space (fileformat.info/info/unicode/char/a0/index.htm), not a standard space (fileformat.info/info/unicode/char/0020/index.htm).

            – bakercp
            Sep 4 '13 at 3:07











          • I tried several regex-based solutions and Jacob's is the best I've found.

            – bakercp
            Sep 4 '13 at 3:32











          • @bakercp tried that myself as well, haha, without success

            – Jacob Jan Tuinstra
            Sep 4 '13 at 8:06















          1














          I did a quick test and was able to get A2 and B2 to add without a problem. Please see:



          https://docs.google.com/spreadsheet/ccc?key=0AvRseCY0-3SVdEJybVU5U1pZYzdxX3NzNEVOekxFOVE&usp=sharing



          Perhaps there is some column formatting on your values?






          share|improve this answer























          • please check the sheet that i pasted

            – debal
            Sep 3 '13 at 16:15











          • I just noticed that the space in your first example is actually a non-breaking space (fileformat.info/info/unicode/char/a0/index.htm), not a standard space (fileformat.info/info/unicode/char/0020/index.htm).

            – bakercp
            Sep 4 '13 at 3:07











          • I tried several regex-based solutions and Jacob's is the best I've found.

            – bakercp
            Sep 4 '13 at 3:32











          • @bakercp tried that myself as well, haha, without success

            – Jacob Jan Tuinstra
            Sep 4 '13 at 8:06













          1












          1








          1







          I did a quick test and was able to get A2 and B2 to add without a problem. Please see:



          https://docs.google.com/spreadsheet/ccc?key=0AvRseCY0-3SVdEJybVU5U1pZYzdxX3NzNEVOekxFOVE&usp=sharing



          Perhaps there is some column formatting on your values?






          share|improve this answer













          I did a quick test and was able to get A2 and B2 to add without a problem. Please see:



          https://docs.google.com/spreadsheet/ccc?key=0AvRseCY0-3SVdEJybVU5U1pZYzdxX3NzNEVOekxFOVE&usp=sharing



          Perhaps there is some column formatting on your values?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 3 '13 at 16:03









          bakercpbakercp

          859711




          859711












          • please check the sheet that i pasted

            – debal
            Sep 3 '13 at 16:15











          • I just noticed that the space in your first example is actually a non-breaking space (fileformat.info/info/unicode/char/a0/index.htm), not a standard space (fileformat.info/info/unicode/char/0020/index.htm).

            – bakercp
            Sep 4 '13 at 3:07











          • I tried several regex-based solutions and Jacob's is the best I've found.

            – bakercp
            Sep 4 '13 at 3:32











          • @bakercp tried that myself as well, haha, without success

            – Jacob Jan Tuinstra
            Sep 4 '13 at 8:06

















          • please check the sheet that i pasted

            – debal
            Sep 3 '13 at 16:15











          • I just noticed that the space in your first example is actually a non-breaking space (fileformat.info/info/unicode/char/a0/index.htm), not a standard space (fileformat.info/info/unicode/char/0020/index.htm).

            – bakercp
            Sep 4 '13 at 3:07











          • I tried several regex-based solutions and Jacob's is the best I've found.

            – bakercp
            Sep 4 '13 at 3:32











          • @bakercp tried that myself as well, haha, without success

            – Jacob Jan Tuinstra
            Sep 4 '13 at 8:06
















          please check the sheet that i pasted

          – debal
          Sep 3 '13 at 16:15





          please check the sheet that i pasted

          – debal
          Sep 3 '13 at 16:15













          I just noticed that the space in your first example is actually a non-breaking space (fileformat.info/info/unicode/char/a0/index.htm), not a standard space (fileformat.info/info/unicode/char/0020/index.htm).

          – bakercp
          Sep 4 '13 at 3:07





          I just noticed that the space in your first example is actually a non-breaking space (fileformat.info/info/unicode/char/a0/index.htm), not a standard space (fileformat.info/info/unicode/char/0020/index.htm).

          – bakercp
          Sep 4 '13 at 3:07













          I tried several regex-based solutions and Jacob's is the best I've found.

          – bakercp
          Sep 4 '13 at 3:32





          I tried several regex-based solutions and Jacob's is the best I've found.

          – bakercp
          Sep 4 '13 at 3:32













          @bakercp tried that myself as well, haha, without success

          – Jacob Jan Tuinstra
          Sep 4 '13 at 8:06





          @bakercp tried that myself as well, haha, without success

          – Jacob Jan Tuinstra
          Sep 4 '13 at 8:06

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18596651%2fremove-leading-space-from-columns%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

          Museum of Modern and Contemporary Art of Trento and Rovereto