0

Is there a function/formula to return only the first string proceeding the first carriage return using Google Sheets?

Example Text:

Bob & Mary Smith   
bob@email.com   
555-111-1234   

Assuming the above text is in cell A1, I would like the formula to return the following to Cell B1 "Bob & Mary Smith"

1

Generally speaking, this would do it:

=REGEXEXTRACT(A1,"(.+)\n")

0

Traditional way

=LEFT(A1,FIND(CHAR(10)) - 1)

OR

=LEFT(A1,FIND(CHAR(13)) - 1)
  • Use CHAR(10) for line feed (\n)
  • Use CHAR(13) for carriage return (\r\n )
2
  • 2
    that will always give an error. Did you mean =iferror( left(A1, find(char(10), A1) - 1), A1 )? – doubleunary Apr 16 at 6:02
  • You are right. Thanks. – Rubén Apr 16 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.