简体   繁体   English

从文件名中提取人名

[英]Extracting person name from file name

I have a column of file names in the format {lastName}_{firstName}_{termInfo}_{Progress_Report/Transcript}_randomstringofcharacters.pdf我有一列文件名,格式为{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.我想从中提取一个名为lastName, firstName的变量,以便我可以运行 vlookup 以将其与 ID 匹配。 Is there an easy way to write a formula to do this?有没有一种简单的方法可以编写公式来执行此操作?

Thanks!谢谢!

try:尝试:

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

在此处输入图像描述

for array:对于数组:

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

在此处输入图像描述

Option 01选项 01

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

在此处输入图像描述

Option 02选项 02

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

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM