Kyle Johnson
Kyle Johnson

Reputation: 13

Google Sheets Trim after either of characters

I have a column of cells in Google Sheets with text in the following formats:

PLAYBILL59; Code Description Here
BROADWAYBOX59: Code Description Here
TICKETCODE: Code Description Here

I want to create a formula that deletes everything after and including either a colon or semi-colon, that would leave:

PLAYBILL59
BROADWAYBOX59
TICKETCODE

I've been trying for hours with no luck.

Any suggestions very appreciated.

Upvotes: 1

Views: 2428

Answers (2)

D.Dimitrioglo
D.Dimitrioglo

Reputation: 3663

Let's say that your colum is A, then you can use REGEXEXTRACT in your formula like

=REGEXEXTRACT(A1; "[A-Z0-9-a-z]+")

enter image description here

Upvotes: 3

Ed Nelson
Ed Nelson

Reputation: 10259

Assuming your text string is in A1, try:

=SUBSTITUTE(SUBSTITUTE(A1, "; Code Description Here",""), ": Code Description Here", "")

Upvotes: 1

Related Questions