I have a large list of people where each person has a line like this.
Bill Gates, IT Manager, Microsoft, <https://www.linkedin.com/in/williamhgates>
I want to extract the company name in a specific cell. In this example, it would be Microsoft, which is between the second and third delimiters (in this case, the delimiter is ", "
). How can I do this?
Right now I'm using the split method (=SPLIT(A2, ", ",false)
). But it gives me four different cells with information. I would like a command only to output the company in one cell. Can anyone help? I have tried different things, but I can't seem to find anything that works.
Maybe some regex can do it, but I'm not into regex.
答案 0 :(得分:2)
Use INDEX and SPLIT to get the value between two separators. Example
=INDEX(SPLIT(A1,", ",FALSE),2)
答案 1 :(得分:0)
A bit nasty, but this formula works, assuming data in cell D3.
=MID(D3,FIND(",",D3,FIND(",",D3)+1)+2,FIND(",",D3,FIND(",",D3,FIND(",",D3)+1)+1)-FIND(",",D3,FIND(",",D3)+1)-2)
Broken down, this is what it does:
=MID(D3
FIND(",",D3,FIND(",",D3)+1)+2
FIND(",",D3,FIND(",",D3,FIND(",",D3)+1)+1)-FIND(",",D3,FIND(",",D3)+1)-2)
答案 2 :(得分:0)
我将添加我最喜欢的ArratFormula,您可以使用它自动展开列表,而不会使用draggind公式。假设:
在这种情况下,您可以使用Arrayformula,粘贴在单元格B1中:
=ArrayFormula(REGEXEXTRACT(A1:A20,", ([^,]+), <"))
如果您的数据总是看起来像&#34; ...,公司名称,&lt; ...&#34;或者你希望得到不同的输出,在单元格B1中使用这个公式:
=QUERY(QUERY(TRANSPOSE(SPLIT(JOIN(", ",A1:A20),", ",0)),"offset 2"),"skipping 4")
在这个公式中:
offset 2
中的2更改为0,1,2,3以获取姓名,职位,公司,链接skipping 4
4中有许多项目。项目数量可按公式计算:
=len(A1)-len(SUBSTITUTE(A1,",",""))+1
,最终公式是:
=QUERY(QUERY(TRANSPOSE(SPLIT(JOIN(", ",A1:A20),", ",0)),"offset 2"),
"skipping "&len(A1)-len(SUBSTITUTE(A1,",",""))+1)