Replace with line break (Excel for Mac) Excel Discussion in 'Microsoft Office' started by eleonb, Apr 10, 2011. Joined: Apr 10, 2011. Is there a way to represent the line break within the Excel 'Replace' tool, just like ^p in the Word 'Replace' tool? Or is there a way to paste a Word table (which has line breaks within the table.
I've imported some data into Excel (from a text file) and it contains some sort of newline characters. It looks like this initially: If I hit F2 (to edit) then Enter (to save changes) on each of the cells with a newline (without actually editing anything), Excel automatically changes the layout to look like this: I don't want these newlines characters here, as it messes up data processing further down the track. How can I do a search for these to detect more of them? The usual search function doesn't accept an enter character as a search character.
In Excel the standard line break Alt + Enter character is ASCII 10. From the look of your screenshot it appears there is another character, probably ASCII 13. To find these, in the standard Find (or Replace) dialog, in the Find What field, use the standard method of entering ASCII character codes: hold down Alt and type (on the numeric keypad) the character code, i.e., Alt 0010 for just the line break, or Alt 0013 (release Alt and press again) Alt 0010 If that extra character is not a ASCII 13, you can use the function =Code(AString) to get the code of the left most character of a string. The mid function can parse through multiple lines. Let's say this address is in cell A1: Google, Inc. 1600 Amphitheatre Pkwy Mountain View, CA 94043 Let's grab the street address on the second line.
The first step is determine the position number of the two return characters. The first return character is found at '13' with this: =SEARCH(CHAR(10),A1) The second return character is found at '36' with this: =SEARCH(CHAR(10),A1,SEARCH(CHAR(10),A1)+1) Now the second step. We need to return our address text between the two character counts 13 & 36. Here the formula is nested together: =MID(A1,SEARCH(CHAR(10),A1),SEARCH(CHAR(10),A1,SEARCH(CHAR(10),A1)+1)-SEARCH(CHAR(10),A1)).