Search code examples
excelgoogle-sheetsgoogle-sheets-api

How do I trim multiple lines in the same Google Sheet/Excel cell?


How do I trim multiple lines in a single cell in Google Sheets?

I am able to trim the first line using the following:

=TRIM(LEFT(K2,FIND("        ",K2)))

Here is an example of a cell of my data:

(253) 473-2043        (PT) (L) (100%) [Feedback]
(720) 242-9015        (MT) (L) (100%) [Feedback]
(720) 413-6453        (MT) (M) (86%) [Feedback]
(253) 209-6014        (PT) (M) (66%) [Feedback]
(253) 471-7777        (PT) (66%) [Feedback]
(706) 414-0490        (ET) (M) (66%) [Feedback]
(706) 471-7777        (ET) (M) (66%) [Feedback]
(706) 560-1682        (ET) (66%) [Feedback]
(509) 838-3878        (PT) (3%) [Feedback]
(706) 793-2936        (ET) (3%) [Feedback]

This is all contained within one cell. I only need the first 14 characters (phone number) of each line. I'm only able to extract the first line using the code above.


Solution

  • =REGEXREPLACE(A1,"(?m)(\d)( .*)$","$1")