In the generic formula above, “N” represents the “nth line”. Note: In older versions of Excel on a Mac, use CHAR(13) instead of CHAR(10). The CHAR function returns a character based on it’s numeric code. The number of spaces used to replace the line delimiter is based on the total length the text in the cell. The formula then uses the MID function to extract the desired line. The starting point is worked out with: Where “N” stands for “nth line”, which is picked up from row 4 with the D$4 reference. The total characters extracted is equal to the length of the full text string: At this point, we have the “nth line”, surrounded by spaces. Finally, the TRIM function slices off all extra space characters and returns just the line text.
Text to Columns
Don’t forget that Excel has a built-in Text to Columns feature that can split text according to the delimiter of your choice, though it is not a dynamic solution like a formula. On Windows, you can type Control + J to enter the equivalent of a new line character for the “Other” delimiter. You can also use Control + J for new line during search and replace operations. I’m not sure how to enter a new line character in Mac Excel, as a delimiter, or in the search and replace dialog. If you know how, please leave a comment below.
Dave Bruns
Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.