Home > Software engineering >  Getting specific strings from cell in google sheet
Getting specific strings from cell in google sheet

Time:06-16

I have a cell that i'm trying to get info out of.

This is the value of the cell C7 "(Liverpool-CAM) Firstname 'Nickname' Lastname"

=IFERROR(REGEXEXTRACT(C7,"\'(.*?)\'"))

My Current formula is getting the nickname inbetween '', i would also like to add the Team name so in this case i would like the output to be Liverpool Nickname so i would like to add the string between "(" and "-".

It needs to have a contingency to only pull the string if there is a "(" infront of it since the names can include hyphens.

Having troubles with this if anyone can help me out.

CodePudding user response:

try:

=IFERROR(REGEXREPLACE(C7, "\((. )\-. '(. )'. ", "$1 $2"))

enter image description here

or:

=IFERROR(REGEXREPLACE(C8, "\((. )\-. \). '(. )'. ", "$1 $2"))

enter image description here

  • Related