+ Reply to Thread
Results 1 to 5 of 5

Line break within formula

  1. #1
    Registered User
    Join Date
    07-12-2006
    Posts
    69

    Line break within formula

    I know that when you are typing in a cell, if you press ALT + ENTER, it will create a line break for you in the cell, and the resulting text will appear on separate lines. What I'm wondering now is if its possible to do this using a formula.

    For example, what I'm trying to do is concatenate multiple bits of data and put them together into a single cell that has multiple lines.

    e.g.

    Date: Jan 1, 2010
    Job: Cleaning
    Time: 4 hours
    Cost: 100

    I want to be able to combine this using something like:

    ="The job of "&A2&" was performed on "&A1&". It took "&A3&" to do and the cost was $"&A4"&"."

    Now this formula would result in:

    The job of Cleaning was performed on Jan 1, 2010. It took 4 hours to do and the cost was $100.

    What I want to do instead is be able to have the result appear like this:

    The job of Cleaning was performed on Jan 1, 2010.
    It took 4 hours to do and the cost was $100.

    All within the single cell. I have lots of data that I would like to "drag down" so that it would automatically fill all of the cells accordingly rather than have all the data on a single line.

    In this example, the single vs. double line isn't really important, but in my application, I want to split the data into 5 different lines, and it would be quite tedious to go through after the fact and split up the lines.

    So is it possible to have a line break like this? Thanks for any help!
    Last edited by Zaraf; 05-21-2010 at 03:11 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Is it possible to have a line break within a formula?

    TRy:

    ="The job of "&A2&" was performed on "&A1&"."&CHAR(10)&"It took "&A3&" to do and the cost was $"&A4"&"."
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    07-12-2006
    Posts
    69

    Re: Is it possible to have a line break within a formula?

    No, that didn't work Still one one line.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Is it possible to have a line break within a formula?

    You have to apply the formatting on the cell.

    Go to Format|Cells and in Alignment tab select Wrap.

    Also note, you have an extra " near the end.. formula is:

    ="The job of "&A2&" was performed on "&A1&"."&CHAR(10)&"It took "&A3&" to do and the cost was $"&A4&"."

  5. #5
    Registered User
    Join Date
    07-12-2006
    Posts
    69

    Re: Is it possible to have a line break within a formula?

    Oh awesome, thanks! That does work now

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1