How to get text after dash in Google Sheets formula?

I’m trying to pull out the part after the dash in my Google Sheets. My current formula works okay for longer text but messes up with shorter stuff. It only grabs one character when the text is short. I want it to get everything after the dash, no matter how long the text is.

Here’s what I’m using now:

={
  "VenueID";
  ARRAYFORMULA(
    IF(
      ISBLANK(A2:A),
      "",
      RIGHT(C2:C, SEARCH("-", C2:C) - 21)
    )
  )
}

Any ideas how to fix this? I need it to work for all lengths of text in column C. Thanks for any help!

I’ve encountered a similar issue before. The problem with your current formula is the fixed subtraction of 21 characters, which doesn’t account for varying text lengths. Here’s a more flexible approach:

=ARRAYFORMULA(IF(ISBLANK(A2:A), “”, TRIM(RIGHT(SUBSTITUTE(C2:C, “-”, REPT(" ", 99)), 99))))

This formula uses SUBSTITUTE to replace the dash with 99 spaces, then extracts the rightmost 99 characters and trims the result. It should work consistently regardless of the text length after the dash. Remember to adjust the column references if needed. Hope this helps solve your problem!

hey finn, try this formula instead:

=ARRAYFORMULA(IF(ISBLANK(A2:A),“”,REGEXEXTRACT(C2:C,“-(.*)”)))

it uses regex to grab everything after the dash. should work for any length. lemme know if u need more help!

I’ve dealt with this exact problem in my work projects. Here’s a solution that’s been reliable for me:

=ARRAYFORMULA(IF(ISBLANK(A2:A), “”, IFERROR(MID(C2:C, FIND(“-”, C2:C) + 1, LEN(C2:C)), C2:C)))

This formula uses MID to extract everything after the dash, starting from the character right after it. The IFERROR part handles cases where there’s no dash, just returning the original text.

It’s been a lifesaver for me when dealing with inconsistent data formats. Give it a try and see if it solves your issue. If you need any clarification on how it works, just ask!