Home > Enterprise >  Extract text from a cell without extracting punctuation in Google Sheets
Extract text from a cell without extracting punctuation in Google Sheets

Time:12-17

In Column F, I have a list of states and their abbreviations.

enter image description here

CodePudding user response:

Are you looking for something like this?

To extract everything before the comma:

=REGEXEXTRACT(A29,"[^,]*")

To extract everything after the comma:

=REGEXEXTRACT(A29,".*,(.*)")

Alaska, "AK" will return Alaska and "AK"

CodePudding user response:

You don't need regex for this, a simple SPLIT will do the job.

=SPLIT(A1,",""")

Or as an array formula:

=ArrayFormula(IFERROR(SPLIT(A1:A,""",")))
  • Related