{"text_format":"1","workbook":"xlsx","n_sheets":5,"sheets":["Extract first line - Examples","Extract 1st line with formula","Extract 1st line in Excel 365","Extract 1st line with Regex","Delete first line with VBA"],"not_rendered":{"charts":0,"images":4,"macros":1,"external_links":0,"defined_names":0,"comments":0,"pivot_tables":0},"unopened":[],"bounds":{"document_bytes":16777216,"sheet_cells":100000,"rows_first":2000,"rows_last":500,"rows_between":2000,"halvings":0,"cell_chars":16384,"cell_head_chars":4096},"cells_cut":0,"cells_raw":0,"read":"whole","date_system":"1900"}

{"sheet":"Extract first line - Examples","index":0,"n_rows":31,"n_cols":7,"rows_kept":31,"cut":false,"hidden":false,"merged":[[3,1,3,2],[5,1,5,2],[8,2,8,3],[11,1,11,2]]}
[]
[]
[]
[null,"Extract First Line in Excel Cell"]
[]
[null,"The workbook shows how to extract the first line of text from Excel cells using formulas, regular expressions and VBA macros."]
[null,"Author","Ablebits.com"]
[null,"Last update","2023-08-28"]
[null,"Tutorial URL","How to extract the first line in Excel cell"]
[]
[null,"Examples:"]
["• ","Extract first line with a formula"]
["• ","Get first line of text in Excel 365 "]
["• ","Pull first line from cell using RegEx "]
["• ","Copy first lines to another sheet with VBA "]
[]
[]
[null,null,null,null,null,null," "]
[]
[]
[]
[]
[]
[null,"The workbook contains the following macro:"]
[null,"ExtractFirstLine - pulls the first line of text from selected cells into a new worksheet."]
[]
[null,"How to use the macros:"]
[null,"1. Keep this workbook open."]
[null,"2. Open your own workbook in which you want to extract text."]
[null,"3. In your workbook, select the range of cells containing the text you want to extract the first line from."]
[null,"4. Press Alt + F8, select the ExtractFirstLine macro, and click Run."]

{"sheet":"Extract 1st line with formula","index":1,"n_rows":28,"n_cols":16,"rows_kept":28,"cut":false,"hidden":false,"merged":[[0,0,0,1]]}
["Extract first line from Excel cell"]
["Original text","First line"]
["Mary had a little lamb,  \nit’s fleece was white as snow.\nAnd everywhere that Mary went, \nthe lamb was sure to go. \nIt followed her to school one day\nand broke the teacher’s rule \nAnd what a time did they \nhave that day at school.",{"$f":"IFERROR(LEFT(A3, FIND(CHAR(10), A3) -1), A3)","v":"Mary had a little lamb,  "}]
["Little Boy Blue come blow your horn.  \nThe sheep’s in the meadow, the cow’s in the corn. \nBut where’s the boy who looks after the sheep? \nHe’s under a haystack fast asleep. \nWill you wake him? No – not I. \nFor if I do, he’s sure to cry.","Little Boy Blue come blow your horn.  "]
["Humpty Dumpty sat on a wall. \nHumpty Dumpty had a great fall. \nAll the Kings horses, and all the king’s men, \ncouldn’t put Humpty together again. ","Humpty Dumpty sat on a wall. "]
["Now I know my ABCs\nNext time won’t you sing with me.","Now I know my ABCs"]
["Hickory dickory dock, the mouse ran up the clock.","Hickory dickory dock, the mouse ran up the clock."]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null," "]

{"sheet":"Extract 1st line in Excel 365","index":2,"n_rows":32,"n_cols":16,"rows_kept":32,"cut":false,"hidden":false,"merged":[[0,0,0,1]]}
["Extract first line in Excel 365"]
["Original text","First line"]
["Mary had a little lamb,  \nit’s fleece was white as snow.\nAnd everywhere that Mary went, \nthe lamb was sure to go. \nIt followed her to school one day\nand broke the teacher’s rule \nAnd what a time did they \nhave that day at school.",{"$f":"IFERROR(_xlfn.TEXTBEFORE(A3, CHAR(10)), A3)","v":"Mary had a little lamb,  "}]
["Little Boy Blue come blow your horn.  \nThe sheep’s in the meadow, the cow’s in the corn. \nBut where’s the boy who looks after the sheep? \nHe’s under a haystack fast asleep. \nWill you wake him? No – not I. \nFor if I do, he’s sure to cry.",{"$f":"IFERROR(_xlfn.TEXTBEFORE(A4, CHAR(10)), A4)","v":"Little Boy Blue come blow your horn.  "}]
["Humpty Dumpty sat on a wall. \nHumpty Dumpty had a great fall. \nAll the Kings horses, and all the king’s men, \ncouldn’t put Humpty together again. ","Humpty Dumpty sat on a wall. "]
["Now I know my ABCs\nNext time won’t you sing with me.","Now I know my ABCs"]
["Hickory dickory dock, the mouse ran up the clock.","Hickory dickory dock, the mouse ran up the clock."]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null," "]

{"sheet":"Extract 1st line with Regex","index":3,"n_rows":17,"n_cols":4,"rows_kept":17,"cut":false,"hidden":false,"merged":[[0,0,0,1]]}
["Extract first line using RegEx"]
["Original text","First line"]
["Mary had a little lamb,  \nit’s fleece was white as snow.\nAnd everywhere that Mary went, \nthe lamb was sure to go. \nIt followed her to school one day\nand broke the teacher’s rule \nAnd what a time did they \nhave that day at school.",{"$f":"IF(RegExpExtract(A3, \".*\\n\", 1)=\"\", A3, RegExpExtract(A3, \".*\\n\", 1))","v":"Mary had a little lamb,  \n"}]
["Little Boy Blue come blow your horn.  \nThe sheep’s in the meadow, the cow’s in the corn. \nBut where’s the boy who looks after the sheep? \nHe’s under a haystack fast asleep. \nWill you wake him? No – not I. \nFor if I do, he’s sure to cry.",{"$f":"IF(RegExpExtract(A4, \".*\\n\", 1)=\"\", A4, RegExpExtract(A4, \".*\\n\", 1))","v":"Little Boy Blue come blow your horn.  \n"}]
["Humpty Dumpty sat on a wall. \nHumpty Dumpty had a great fall. \nAll the Kings horses, and all the king’s men, \ncouldn’t put Humpty together again. ",{"$f":"IF(RegExpExtract(A5, \".*\\n\", 1)=\"\", A5, RegExpExtract(A5, \".*\\n\", 1))","v":"Humpty Dumpty sat on a wall. \n"}]
["Now I know my ABCs\nNext time won’t you sing with me.",{"$f":"IF(RegExpExtract(A6, \".*\\n\", 1)=\"\", A6, RegExpExtract(A6, \".*\\n\", 1))","v":"Now I know my ABCs\n"}]
["Hickory dickory dock, the mouse ran up the clock.",{"$f":"IF(RegExpExtract(A7, \".*\\n\", 1)=\"\", A7, RegExpExtract(A7, \".*\\n\", 1))","v":"Hickory dickory dock, the mouse ran up the clock."}]
[]
[]
[]
[]
[]
[]
[]
[]
[]
[null,null,null," "]

{"sheet":"Delete first line with VBA","index":4,"n_rows":17,"n_cols":1,"rows_kept":17,"cut":false,"hidden":false,"merged":[]}
["Copy first line of text with VBA"]
["Source data"]
["Mary had a little lamb,  \nit’s fleece was white as snow.\nAnd everywhere that Mary went, \nthe lamb was sure to go. \nIt followed her to school one day\nand broke the teacher’s rule \nAnd what a time did they \nhave that day at school."]
["Little Boy Blue come blow your horn.  \nThe sheep’s in the meadow, the cow’s in the corn. \nBut where’s the boy who looks after the sheep? \nHe’s under a haystack fast asleep. \nWill you wake him? No – not I. \nFor if I do, he’s sure to cry."]
["Humpty Dumpty sat on a wall. \nHumpty Dumpty had a great fall. \nAll the Kings horses, and all the king’s men, \ncouldn’t put Humpty together again. "]
["Now I know my ABCs\nNext time won’t you sing with me."]
["Hickory dickory dock, the mouse ran up the clock."]
[]
["How to use the macro to delete the first line of text in a cell:"]
[" "]
["1. Select the range A3:A7."]
["2. Press Alt + F8 to open the macro dialog box."]
["3. Choose the ExtractFirstLine macro."]
["4. Click Run to execute the code."]
[]
["Result"]
["The macro will create a new sheet named \"Extract 1st line - results\" and copy the extracted first lines from the selected range into that sheet."]