Microsoft-excel newlines and tab












12














Current I use "CONCATENATE" to join string in Excel, but I want insert character newlines and tab in string joined by "CONCATENATE".



Example:





  • I've string below when I completed join string.



    "Today is very beautiful"



  • I expected string newlines and tab auto as below:




Today is
verry
beautiful



How to do that?










share|improve this question




















  • 1




    Not a solution for Excel users, but it might help someone: The spreadsheet program "Gnumeric" accepts tabs.
    – Nicolas Raoul
    Sep 2 '16 at 7:54
















12














Current I use "CONCATENATE" to join string in Excel, but I want insert character newlines and tab in string joined by "CONCATENATE".



Example:





  • I've string below when I completed join string.



    "Today is very beautiful"



  • I expected string newlines and tab auto as below:




Today is
verry
beautiful



How to do that?










share|improve this question




















  • 1




    Not a solution for Excel users, but it might help someone: The spreadsheet program "Gnumeric" accepts tabs.
    – Nicolas Raoul
    Sep 2 '16 at 7:54














12












12








12


1





Current I use "CONCATENATE" to join string in Excel, but I want insert character newlines and tab in string joined by "CONCATENATE".



Example:





  • I've string below when I completed join string.



    "Today is very beautiful"



  • I expected string newlines and tab auto as below:




Today is
verry
beautiful



How to do that?










share|improve this question















Current I use "CONCATENATE" to join string in Excel, but I want insert character newlines and tab in string joined by "CONCATENATE".



Example:





  • I've string below when I completed join string.



    "Today is very beautiful"



  • I expected string newlines and tab auto as below:




Today is
verry
beautiful



How to do that?







microsoft-excel microsoft-office microsoft-excel-2007 worksheet-function






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 19 '12 at 5:05







Boy's Rules

















asked Mar 19 '12 at 4:26









Boy's RulesBoy's Rules

61114




61114








  • 1




    Not a solution for Excel users, but it might help someone: The spreadsheet program "Gnumeric" accepts tabs.
    – Nicolas Raoul
    Sep 2 '16 at 7:54














  • 1




    Not a solution for Excel users, but it might help someone: The spreadsheet program "Gnumeric" accepts tabs.
    – Nicolas Raoul
    Sep 2 '16 at 7:54








1




1




Not a solution for Excel users, but it might help someone: The spreadsheet program "Gnumeric" accepts tabs.
– Nicolas Raoul
Sep 2 '16 at 7:54




Not a solution for Excel users, but it might help someone: The spreadsheet program "Gnumeric" accepts tabs.
– Nicolas Raoul
Sep 2 '16 at 7:54










7 Answers
7






active

oldest

votes


















16














As TAB cannot be displayed in Excel cell, instead of using CHAR(9), in order to indent the line, I recommend using spaces. By using REPT() function, it will be easier to control the indent width by specifying the number of spaces (e.g. 4).



=CONCATENATE(A1, CHAR(10), REPT(" ", 4), A2)


Alternatively, I usually use & for concatenation to simplify the formula.



=A1 & CHAR(10) & REPT(" ", 4) & A2


Lastly, you have to format the cell as "Wrap text" by CTRL-1 > Alignment






share|improve this answer





























    9














    You can try this formula:-



    =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1)


    Here



    CHAR(10) - Line Feed/New Line
    CHAR(9) - Horizontal Tab


    To see new line, you need to mark as checked on the Wrap Text box



    Right click on Cell --> Format Cells --> Click on Alignment Tab --> Under Text control --> Check the box "Wrap Text"



    Note: Tab spacing won't appear on the Cell






    share|improve this answer





















    • Here's a link to the Excel help for the CHAR function. Here's the table of values that you can use on Windows and on Mac via Wikipedia. It is important to note that the results may be different on each OS.
      – Elliott
      Jun 11 '17 at 17:23





















    2














    You could try adding newline and tabs yourself, as just another text element:



    =CONCATENATE("Today is", Chr(13), Chr(9), "verry", Chr(13), Chr(9), "beautiful"


    whereas Chr(13) produces a newline and Chr(9) a tab.






    share|improve this answer





















    • Sorry Boy's Rules, Char(13) is a carriage return, not new line. My bad
      – boretom
      Mar 28 '12 at 19:10



















    1














    This post is old, but I wasn't able to find any satisfying answer to this question anywhere on Google, hence here's what I've come up with:



    =CONCAT("Today is";CHAR(10);REPT(CHAR(1);2);"very";CHAR(10);REPT(CHAR(1);2);"beautiful")


    will display as:



    enter image description here



    ...which is more or less like this:



    Today is
    very
    beautiful


    CHAR(1) is the unprintable "Start of Heading" character in the ASCII system



    Microsoft Office 365 ProPlus






    share|improve this answer










    New contributor




    PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


























      0














      You can also use "&" chars to concatenate text in Excel, as below:



      The clause: =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1) could be written as:



       =A1&CHAR(10)&CHAR(9)&B1&CHAR(10)&CHAR(9)&C1


      This form will be interesting when CONCATENATE overflows (it has a limit of entries).






      share|improve this answer































        0














        There seems to be no way to make

        ="some string"&char(9)&"another string"

        work. The resulting text pasted as plain text in a txt file or a as unformated text in word is as follows:

        "some string another string"

        Including the unwanted double quotes.
        If pasted as keep or merged formatting it is as follows:

        some string another string

        Please note that the tab has been replaced with a single space.



        If instead of char(9) a printable character such as “!” char(33) the resulting text pasted in word or a text editor is always:

        some string!another string



        The bottom line is:



        Currently there appears to be no method to insert a tab in a cell. This is a pity as there is a genuine need for this. A workaround is to insert a character that isn’t expected in the cell and then use a post processer or a macro in the target editor. I intend to use a grave (just above the tab) and a word VBA macro to convert it to a tab.






        share|improve this answer





























          0














          Simple: Paste them from text editor as quoted plain text (TSV format).



          No one mentioned this simple and obvious method so far.





          1. Create the cell content in Notepad with actual tab and newline characters. This example contains them all (here Tab is illustrated as ):



            Before Tab↹AfterTab
            Second "line" of the same cell.



          2. Surround the entire content with double quotes " (A conversion into TSV format).





            • Should be there any double quotes already inside the original text, double them. For better clarity I put them into the above example.
              The above example will now look like:



              "Before Tab↹AfterTab
              Second ""line"" of the same cell."




          3. Mark the entire text (Ctrl+A) and press Ctrl+C copy it into clipboard.


          4. In Excel, navigate to the cell (but do not enter its edit mode) and press Ctrl+V to paste.


          Done. Now the cell content is exactly as you expect it, including newlines and tabs. (You can verify it by formulas, VBA or by round trip, i.e. by copy-paste back to text file). Mandatory notices:




          • You might need to increase row height to reveal the second line.


          • Do not expect correct formatting of contained Tab characters. (But you know that already.) Excel is not designed to handle them properly inside the cell. Should you need left indentation of cell content, open Format Cells window (Ctrl+1) and set the Indent value on Alignment tab.



          Tip: You can insert multiple cells by using newline and tab outside the quotes.



          This example (two rows by two columns in TSV) will insert area of 2×2 cells at once:



          A1↹B1
          A2↹B2


          If you see its point, you can add newlines and tabs inside the values:



          "A↹1
          cell"↹"B↹1
          cell"
          "A↹2
          cell"↹"B↹2
          cell"


          Tested with Excel 2016.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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%2fsuperuser.com%2fquestions%2f402277%2fmicrosoft-excel-newlines-and-tab%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            7 Answers
            7






            active

            oldest

            votes








            7 Answers
            7






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            16














            As TAB cannot be displayed in Excel cell, instead of using CHAR(9), in order to indent the line, I recommend using spaces. By using REPT() function, it will be easier to control the indent width by specifying the number of spaces (e.g. 4).



            =CONCATENATE(A1, CHAR(10), REPT(" ", 4), A2)


            Alternatively, I usually use & for concatenation to simplify the formula.



            =A1 & CHAR(10) & REPT(" ", 4) & A2


            Lastly, you have to format the cell as "Wrap text" by CTRL-1 > Alignment






            share|improve this answer


























              16














              As TAB cannot be displayed in Excel cell, instead of using CHAR(9), in order to indent the line, I recommend using spaces. By using REPT() function, it will be easier to control the indent width by specifying the number of spaces (e.g. 4).



              =CONCATENATE(A1, CHAR(10), REPT(" ", 4), A2)


              Alternatively, I usually use & for concatenation to simplify the formula.



              =A1 & CHAR(10) & REPT(" ", 4) & A2


              Lastly, you have to format the cell as "Wrap text" by CTRL-1 > Alignment






              share|improve this answer
























                16












                16








                16






                As TAB cannot be displayed in Excel cell, instead of using CHAR(9), in order to indent the line, I recommend using spaces. By using REPT() function, it will be easier to control the indent width by specifying the number of spaces (e.g. 4).



                =CONCATENATE(A1, CHAR(10), REPT(" ", 4), A2)


                Alternatively, I usually use & for concatenation to simplify the formula.



                =A1 & CHAR(10) & REPT(" ", 4) & A2


                Lastly, you have to format the cell as "Wrap text" by CTRL-1 > Alignment






                share|improve this answer












                As TAB cannot be displayed in Excel cell, instead of using CHAR(9), in order to indent the line, I recommend using spaces. By using REPT() function, it will be easier to control the indent width by specifying the number of spaces (e.g. 4).



                =CONCATENATE(A1, CHAR(10), REPT(" ", 4), A2)


                Alternatively, I usually use & for concatenation to simplify the formula.



                =A1 & CHAR(10) & REPT(" ", 4) & A2


                Lastly, you have to format the cell as "Wrap text" by CTRL-1 > Alignment







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 19 '12 at 9:38









                wilsonwilson

                3,61311536




                3,61311536

























                    9














                    You can try this formula:-



                    =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1)


                    Here



                    CHAR(10) - Line Feed/New Line
                    CHAR(9) - Horizontal Tab


                    To see new line, you need to mark as checked on the Wrap Text box



                    Right click on Cell --> Format Cells --> Click on Alignment Tab --> Under Text control --> Check the box "Wrap Text"



                    Note: Tab spacing won't appear on the Cell






                    share|improve this answer





















                    • Here's a link to the Excel help for the CHAR function. Here's the table of values that you can use on Windows and on Mac via Wikipedia. It is important to note that the results may be different on each OS.
                      – Elliott
                      Jun 11 '17 at 17:23


















                    9














                    You can try this formula:-



                    =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1)


                    Here



                    CHAR(10) - Line Feed/New Line
                    CHAR(9) - Horizontal Tab


                    To see new line, you need to mark as checked on the Wrap Text box



                    Right click on Cell --> Format Cells --> Click on Alignment Tab --> Under Text control --> Check the box "Wrap Text"



                    Note: Tab spacing won't appear on the Cell






                    share|improve this answer





















                    • Here's a link to the Excel help for the CHAR function. Here's the table of values that you can use on Windows and on Mac via Wikipedia. It is important to note that the results may be different on each OS.
                      – Elliott
                      Jun 11 '17 at 17:23
















                    9












                    9








                    9






                    You can try this formula:-



                    =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1)


                    Here



                    CHAR(10) - Line Feed/New Line
                    CHAR(9) - Horizontal Tab


                    To see new line, you need to mark as checked on the Wrap Text box



                    Right click on Cell --> Format Cells --> Click on Alignment Tab --> Under Text control --> Check the box "Wrap Text"



                    Note: Tab spacing won't appear on the Cell






                    share|improve this answer












                    You can try this formula:-



                    =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1)


                    Here



                    CHAR(10) - Line Feed/New Line
                    CHAR(9) - Horizontal Tab


                    To see new line, you need to mark as checked on the Wrap Text box



                    Right click on Cell --> Format Cells --> Click on Alignment Tab --> Under Text control --> Check the box "Wrap Text"



                    Note: Tab spacing won't appear on the Cell







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 19 '12 at 9:30









                    Siva CharanSiva Charan

                    3,66321728




                    3,66321728












                    • Here's a link to the Excel help for the CHAR function. Here's the table of values that you can use on Windows and on Mac via Wikipedia. It is important to note that the results may be different on each OS.
                      – Elliott
                      Jun 11 '17 at 17:23




















                    • Here's a link to the Excel help for the CHAR function. Here's the table of values that you can use on Windows and on Mac via Wikipedia. It is important to note that the results may be different on each OS.
                      – Elliott
                      Jun 11 '17 at 17:23


















                    Here's a link to the Excel help for the CHAR function. Here's the table of values that you can use on Windows and on Mac via Wikipedia. It is important to note that the results may be different on each OS.
                    – Elliott
                    Jun 11 '17 at 17:23






                    Here's a link to the Excel help for the CHAR function. Here's the table of values that you can use on Windows and on Mac via Wikipedia. It is important to note that the results may be different on each OS.
                    – Elliott
                    Jun 11 '17 at 17:23













                    2














                    You could try adding newline and tabs yourself, as just another text element:



                    =CONCATENATE("Today is", Chr(13), Chr(9), "verry", Chr(13), Chr(9), "beautiful"


                    whereas Chr(13) produces a newline and Chr(9) a tab.






                    share|improve this answer





















                    • Sorry Boy's Rules, Char(13) is a carriage return, not new line. My bad
                      – boretom
                      Mar 28 '12 at 19:10
















                    2














                    You could try adding newline and tabs yourself, as just another text element:



                    =CONCATENATE("Today is", Chr(13), Chr(9), "verry", Chr(13), Chr(9), "beautiful"


                    whereas Chr(13) produces a newline and Chr(9) a tab.






                    share|improve this answer





















                    • Sorry Boy's Rules, Char(13) is a carriage return, not new line. My bad
                      – boretom
                      Mar 28 '12 at 19:10














                    2












                    2








                    2






                    You could try adding newline and tabs yourself, as just another text element:



                    =CONCATENATE("Today is", Chr(13), Chr(9), "verry", Chr(13), Chr(9), "beautiful"


                    whereas Chr(13) produces a newline and Chr(9) a tab.






                    share|improve this answer












                    You could try adding newline and tabs yourself, as just another text element:



                    =CONCATENATE("Today is", Chr(13), Chr(9), "verry", Chr(13), Chr(9), "beautiful"


                    whereas Chr(13) produces a newline and Chr(9) a tab.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 19 '12 at 6:29









                    boretomboretom

                    33626




                    33626












                    • Sorry Boy's Rules, Char(13) is a carriage return, not new line. My bad
                      – boretom
                      Mar 28 '12 at 19:10


















                    • Sorry Boy's Rules, Char(13) is a carriage return, not new line. My bad
                      – boretom
                      Mar 28 '12 at 19:10
















                    Sorry Boy's Rules, Char(13) is a carriage return, not new line. My bad
                    – boretom
                    Mar 28 '12 at 19:10




                    Sorry Boy's Rules, Char(13) is a carriage return, not new line. My bad
                    – boretom
                    Mar 28 '12 at 19:10











                    1














                    This post is old, but I wasn't able to find any satisfying answer to this question anywhere on Google, hence here's what I've come up with:



                    =CONCAT("Today is";CHAR(10);REPT(CHAR(1);2);"very";CHAR(10);REPT(CHAR(1);2);"beautiful")


                    will display as:



                    enter image description here



                    ...which is more or less like this:



                    Today is
                    very
                    beautiful


                    CHAR(1) is the unprintable "Start of Heading" character in the ASCII system



                    Microsoft Office 365 ProPlus






                    share|improve this answer










                    New contributor




                    PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.























                      1














                      This post is old, but I wasn't able to find any satisfying answer to this question anywhere on Google, hence here's what I've come up with:



                      =CONCAT("Today is";CHAR(10);REPT(CHAR(1);2);"very";CHAR(10);REPT(CHAR(1);2);"beautiful")


                      will display as:



                      enter image description here



                      ...which is more or less like this:



                      Today is
                      very
                      beautiful


                      CHAR(1) is the unprintable "Start of Heading" character in the ASCII system



                      Microsoft Office 365 ProPlus






                      share|improve this answer










                      New contributor




                      PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.





















                        1












                        1








                        1






                        This post is old, but I wasn't able to find any satisfying answer to this question anywhere on Google, hence here's what I've come up with:



                        =CONCAT("Today is";CHAR(10);REPT(CHAR(1);2);"very";CHAR(10);REPT(CHAR(1);2);"beautiful")


                        will display as:



                        enter image description here



                        ...which is more or less like this:



                        Today is
                        very
                        beautiful


                        CHAR(1) is the unprintable "Start of Heading" character in the ASCII system



                        Microsoft Office 365 ProPlus






                        share|improve this answer










                        New contributor




                        PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.









                        This post is old, but I wasn't able to find any satisfying answer to this question anywhere on Google, hence here's what I've come up with:



                        =CONCAT("Today is";CHAR(10);REPT(CHAR(1);2);"very";CHAR(10);REPT(CHAR(1);2);"beautiful")


                        will display as:



                        enter image description here



                        ...which is more or less like this:



                        Today is
                        very
                        beautiful


                        CHAR(1) is the unprintable "Start of Heading" character in the ASCII system



                        Microsoft Office 365 ProPlus







                        share|improve this answer










                        New contributor




                        PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.









                        share|improve this answer



                        share|improve this answer








                        edited 2 days ago









                        Albin

                        2,3111129




                        2,3111129






                        New contributor




                        PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.









                        answered Jan 5 at 12:11









                        PickNickPickNick

                        112




                        112




                        New contributor




                        PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.





                        New contributor





                        PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.






                        PickNick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.























                            0














                            You can also use "&" chars to concatenate text in Excel, as below:



                            The clause: =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1) could be written as:



                             =A1&CHAR(10)&CHAR(9)&B1&CHAR(10)&CHAR(9)&C1


                            This form will be interesting when CONCATENATE overflows (it has a limit of entries).






                            share|improve this answer




























                              0














                              You can also use "&" chars to concatenate text in Excel, as below:



                              The clause: =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1) could be written as:



                               =A1&CHAR(10)&CHAR(9)&B1&CHAR(10)&CHAR(9)&C1


                              This form will be interesting when CONCATENATE overflows (it has a limit of entries).






                              share|improve this answer


























                                0












                                0








                                0






                                You can also use "&" chars to concatenate text in Excel, as below:



                                The clause: =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1) could be written as:



                                 =A1&CHAR(10)&CHAR(9)&B1&CHAR(10)&CHAR(9)&C1


                                This form will be interesting when CONCATENATE overflows (it has a limit of entries).






                                share|improve this answer














                                You can also use "&" chars to concatenate text in Excel, as below:



                                The clause: =CONCATENATE(A1,CHAR(10),CHAR(9),B1,CHAR(10),CHAR(9),C1) could be written as:



                                 =A1&CHAR(10)&CHAR(9)&B1&CHAR(10)&CHAR(9)&C1


                                This form will be interesting when CONCATENATE overflows (it has a limit of entries).







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Jan 22 '16 at 13:30









                                bummi

                                1,51931421




                                1,51931421










                                answered Jan 22 '16 at 12:38









                                MarcMirMarcMir

                                1




                                1























                                    0














                                    There seems to be no way to make

                                    ="some string"&char(9)&"another string"

                                    work. The resulting text pasted as plain text in a txt file or a as unformated text in word is as follows:

                                    "some string another string"

                                    Including the unwanted double quotes.
                                    If pasted as keep or merged formatting it is as follows:

                                    some string another string

                                    Please note that the tab has been replaced with a single space.



                                    If instead of char(9) a printable character such as “!” char(33) the resulting text pasted in word or a text editor is always:

                                    some string!another string



                                    The bottom line is:



                                    Currently there appears to be no method to insert a tab in a cell. This is a pity as there is a genuine need for this. A workaround is to insert a character that isn’t expected in the cell and then use a post processer or a macro in the target editor. I intend to use a grave (just above the tab) and a word VBA macro to convert it to a tab.






                                    share|improve this answer


























                                      0














                                      There seems to be no way to make

                                      ="some string"&char(9)&"another string"

                                      work. The resulting text pasted as plain text in a txt file or a as unformated text in word is as follows:

                                      "some string another string"

                                      Including the unwanted double quotes.
                                      If pasted as keep or merged formatting it is as follows:

                                      some string another string

                                      Please note that the tab has been replaced with a single space.



                                      If instead of char(9) a printable character such as “!” char(33) the resulting text pasted in word or a text editor is always:

                                      some string!another string



                                      The bottom line is:



                                      Currently there appears to be no method to insert a tab in a cell. This is a pity as there is a genuine need for this. A workaround is to insert a character that isn’t expected in the cell and then use a post processer or a macro in the target editor. I intend to use a grave (just above the tab) and a word VBA macro to convert it to a tab.






                                      share|improve this answer
























                                        0












                                        0








                                        0






                                        There seems to be no way to make

                                        ="some string"&char(9)&"another string"

                                        work. The resulting text pasted as plain text in a txt file or a as unformated text in word is as follows:

                                        "some string another string"

                                        Including the unwanted double quotes.
                                        If pasted as keep or merged formatting it is as follows:

                                        some string another string

                                        Please note that the tab has been replaced with a single space.



                                        If instead of char(9) a printable character such as “!” char(33) the resulting text pasted in word or a text editor is always:

                                        some string!another string



                                        The bottom line is:



                                        Currently there appears to be no method to insert a tab in a cell. This is a pity as there is a genuine need for this. A workaround is to insert a character that isn’t expected in the cell and then use a post processer or a macro in the target editor. I intend to use a grave (just above the tab) and a word VBA macro to convert it to a tab.






                                        share|improve this answer












                                        There seems to be no way to make

                                        ="some string"&char(9)&"another string"

                                        work. The resulting text pasted as plain text in a txt file or a as unformated text in word is as follows:

                                        "some string another string"

                                        Including the unwanted double quotes.
                                        If pasted as keep or merged formatting it is as follows:

                                        some string another string

                                        Please note that the tab has been replaced with a single space.



                                        If instead of char(9) a printable character such as “!” char(33) the resulting text pasted in word or a text editor is always:

                                        some string!another string



                                        The bottom line is:



                                        Currently there appears to be no method to insert a tab in a cell. This is a pity as there is a genuine need for this. A workaround is to insert a character that isn’t expected in the cell and then use a post processer or a macro in the target editor. I intend to use a grave (just above the tab) and a word VBA macro to convert it to a tab.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Aug 15 '17 at 0:45









                                        Rb BolinRb Bolin

                                        41




                                        41























                                            0














                                            Simple: Paste them from text editor as quoted plain text (TSV format).



                                            No one mentioned this simple and obvious method so far.





                                            1. Create the cell content in Notepad with actual tab and newline characters. This example contains them all (here Tab is illustrated as ):



                                              Before Tab↹AfterTab
                                              Second "line" of the same cell.



                                            2. Surround the entire content with double quotes " (A conversion into TSV format).





                                              • Should be there any double quotes already inside the original text, double them. For better clarity I put them into the above example.
                                                The above example will now look like:



                                                "Before Tab↹AfterTab
                                                Second ""line"" of the same cell."




                                            3. Mark the entire text (Ctrl+A) and press Ctrl+C copy it into clipboard.


                                            4. In Excel, navigate to the cell (but do not enter its edit mode) and press Ctrl+V to paste.


                                            Done. Now the cell content is exactly as you expect it, including newlines and tabs. (You can verify it by formulas, VBA or by round trip, i.e. by copy-paste back to text file). Mandatory notices:




                                            • You might need to increase row height to reveal the second line.


                                            • Do not expect correct formatting of contained Tab characters. (But you know that already.) Excel is not designed to handle them properly inside the cell. Should you need left indentation of cell content, open Format Cells window (Ctrl+1) and set the Indent value on Alignment tab.



                                            Tip: You can insert multiple cells by using newline and tab outside the quotes.



                                            This example (two rows by two columns in TSV) will insert area of 2×2 cells at once:



                                            A1↹B1
                                            A2↹B2


                                            If you see its point, you can add newlines and tabs inside the values:



                                            "A↹1
                                            cell"↹"B↹1
                                            cell"
                                            "A↹2
                                            cell"↹"B↹2
                                            cell"


                                            Tested with Excel 2016.






                                            share|improve this answer




























                                              0














                                              Simple: Paste them from text editor as quoted plain text (TSV format).



                                              No one mentioned this simple and obvious method so far.





                                              1. Create the cell content in Notepad with actual tab and newline characters. This example contains them all (here Tab is illustrated as ):



                                                Before Tab↹AfterTab
                                                Second "line" of the same cell.



                                              2. Surround the entire content with double quotes " (A conversion into TSV format).





                                                • Should be there any double quotes already inside the original text, double them. For better clarity I put them into the above example.
                                                  The above example will now look like:



                                                  "Before Tab↹AfterTab
                                                  Second ""line"" of the same cell."




                                              3. Mark the entire text (Ctrl+A) and press Ctrl+C copy it into clipboard.


                                              4. In Excel, navigate to the cell (but do not enter its edit mode) and press Ctrl+V to paste.


                                              Done. Now the cell content is exactly as you expect it, including newlines and tabs. (You can verify it by formulas, VBA or by round trip, i.e. by copy-paste back to text file). Mandatory notices:




                                              • You might need to increase row height to reveal the second line.


                                              • Do not expect correct formatting of contained Tab characters. (But you know that already.) Excel is not designed to handle them properly inside the cell. Should you need left indentation of cell content, open Format Cells window (Ctrl+1) and set the Indent value on Alignment tab.



                                              Tip: You can insert multiple cells by using newline and tab outside the quotes.



                                              This example (two rows by two columns in TSV) will insert area of 2×2 cells at once:



                                              A1↹B1
                                              A2↹B2


                                              If you see its point, you can add newlines and tabs inside the values:



                                              "A↹1
                                              cell"↹"B↹1
                                              cell"
                                              "A↹2
                                              cell"↹"B↹2
                                              cell"


                                              Tested with Excel 2016.






                                              share|improve this answer


























                                                0












                                                0








                                                0






                                                Simple: Paste them from text editor as quoted plain text (TSV format).



                                                No one mentioned this simple and obvious method so far.





                                                1. Create the cell content in Notepad with actual tab and newline characters. This example contains them all (here Tab is illustrated as ):



                                                  Before Tab↹AfterTab
                                                  Second "line" of the same cell.



                                                2. Surround the entire content with double quotes " (A conversion into TSV format).





                                                  • Should be there any double quotes already inside the original text, double them. For better clarity I put them into the above example.
                                                    The above example will now look like:



                                                    "Before Tab↹AfterTab
                                                    Second ""line"" of the same cell."




                                                3. Mark the entire text (Ctrl+A) and press Ctrl+C copy it into clipboard.


                                                4. In Excel, navigate to the cell (but do not enter its edit mode) and press Ctrl+V to paste.


                                                Done. Now the cell content is exactly as you expect it, including newlines and tabs. (You can verify it by formulas, VBA or by round trip, i.e. by copy-paste back to text file). Mandatory notices:




                                                • You might need to increase row height to reveal the second line.


                                                • Do not expect correct formatting of contained Tab characters. (But you know that already.) Excel is not designed to handle them properly inside the cell. Should you need left indentation of cell content, open Format Cells window (Ctrl+1) and set the Indent value on Alignment tab.



                                                Tip: You can insert multiple cells by using newline and tab outside the quotes.



                                                This example (two rows by two columns in TSV) will insert area of 2×2 cells at once:



                                                A1↹B1
                                                A2↹B2


                                                If you see its point, you can add newlines and tabs inside the values:



                                                "A↹1
                                                cell"↹"B↹1
                                                cell"
                                                "A↹2
                                                cell"↹"B↹2
                                                cell"


                                                Tested with Excel 2016.






                                                share|improve this answer














                                                Simple: Paste them from text editor as quoted plain text (TSV format).



                                                No one mentioned this simple and obvious method so far.





                                                1. Create the cell content in Notepad with actual tab and newline characters. This example contains them all (here Tab is illustrated as ):



                                                  Before Tab↹AfterTab
                                                  Second "line" of the same cell.



                                                2. Surround the entire content with double quotes " (A conversion into TSV format).





                                                  • Should be there any double quotes already inside the original text, double them. For better clarity I put them into the above example.
                                                    The above example will now look like:



                                                    "Before Tab↹AfterTab
                                                    Second ""line"" of the same cell."




                                                3. Mark the entire text (Ctrl+A) and press Ctrl+C copy it into clipboard.


                                                4. In Excel, navigate to the cell (but do not enter its edit mode) and press Ctrl+V to paste.


                                                Done. Now the cell content is exactly as you expect it, including newlines and tabs. (You can verify it by formulas, VBA or by round trip, i.e. by copy-paste back to text file). Mandatory notices:




                                                • You might need to increase row height to reveal the second line.


                                                • Do not expect correct formatting of contained Tab characters. (But you know that already.) Excel is not designed to handle them properly inside the cell. Should you need left indentation of cell content, open Format Cells window (Ctrl+1) and set the Indent value on Alignment tab.



                                                Tip: You can insert multiple cells by using newline and tab outside the quotes.



                                                This example (two rows by two columns in TSV) will insert area of 2×2 cells at once:



                                                A1↹B1
                                                A2↹B2


                                                If you see its point, you can add newlines and tabs inside the values:



                                                "A↹1
                                                cell"↹"B↹1
                                                cell"
                                                "A↹2
                                                cell"↹"B↹2
                                                cell"


                                                Tested with Excel 2016.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Oct 4 '17 at 11:35

























                                                answered Oct 4 '17 at 11:10









                                                miroxlavmiroxlav

                                                7,38342567




                                                7,38342567






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Super User!


                                                    • 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.





                                                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                    Please pay close attention to the following guidance:


                                                    • 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%2fsuperuser.com%2fquestions%2f402277%2fmicrosoft-excel-newlines-and-tab%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







                                                    Popular posts from this blog

                                                    How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                                                    is 'sed' thread safe

                                                    How to make a Squid Proxy server?