Forcing a line break in a column in an EXCEL Spreadsheet    -   Excel 2007

Posted on 2012-08-17
Last Modified: 2012-08-20
I have a column that is a concatenation of multiple columns.  I would like to put these columns into one string.

In doing this is there a way to cause a line feed within a column.  This would be similar to the "<br />" in HTML.
If my string reads  "John Doe  Doctor   04/04/1962"

I would like to display
John Doe
Question by:morinia
    LVL 6

    Expert Comment

    add CHAR(10) as the character for a line break (as the equivalent of the BR tag)
    LVL 17

    Expert Comment

    You can use Char(10) as leuqarte suggested, e.g.

    Open in new window

    , but it only works if you set the cell format to wrap text (Alignment...wrap text for pre-2007 Excel, or Wrap text from the Home tab for 2007/2010

    Author Comment

    Can Char(10) be put into a select statement

    (Select fname + '  ' + lname ) as name
    LVL 8

    Expert Comment

    by:Elton Pascua
    Hi Morinia,

    Yes you can but what's the nature of the Select statement? What is the code trying to accomplish?

    Author Comment

    I have this select statment

    , (Select cast(case_type_desc as nvarchar(25)) + ' - ' +  Cast(row_created as nvarchar(11)) + ' - ' + cast(system_login as nvarchar(20)) + ' - ' + cast(risk_level_desc as nvarchar(22)) + '        Case Closed: ' +  + cast(case_close_date as nvarchar(11)) + ' ' +  cast(close_reason_desc as nvarchar(50)))  as case_lit
    From Cases

    I would like to put a break after row_created, risk_level_desc, close_reason_desc
    LVL 8

    Expert Comment

    by:Elton Pascua
    I'm sorry, this code is unfamiliar to me. Looks like an SQL statement not VBA.

    Author Comment

    It is SQL.  How would yo do it in VBA.  This is SQL running in EXCEL, so I can put VB code in.
    LVL 92

    Accepted Solution


    Cast(row_created as nvarchar(11)) + ' - '


    Cast(row_created as nvarchar(11)) + CHAR(10)

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now