Home > Software engineering >  Extracting person name from file name
Extracting person name from file name

Time:10-01

I have a column of file names in the format {lastName}_{firstName}_{termInfo}_{Progress_Report/Transcript}_randomstringofcharacters.pdf

I would like to extract from this a variable that is lastName, firstName so that I can run a vlookup to match it to IDs. Is there an easy way to write a formula to do this?

Thanks!

CodePudding user response:

try:

=JOIN(", ", ARRAY_CONSTRAIN(SPLIT(A1, "{_}"), 9^9, 2))

enter image description here

for array:

=IFERROR(BYROW(A1:A, LAMBDA(x, JOIN(", ", ARRAY_CONSTRAIN(SPLIT(x, "{_}"), 9^9, 2)))))

enter image description here

CodePudding user response:

Option 01

=ArrayFormula(REGEXREPLACE(ARRAY_CONSTRAIN(SPLIT(A3,"_"),1,2), "\{|\}", ""))

enter image description here

Option 02

=ArrayFormula(BYROW(A2:A, 
 LAMBDA(rg, IFERROR(TEXTJOIN(", ",1,
 REGEXREPLACE(ARRAY_CONSTRAIN(SPLIT(rg,"_"),1,2), "\{|\}", "")),""))))

enter image description here

  • Related