简体   繁体   中英

Formula to extract usernames of instagram links in Excel sheet

在此处输入图片说明 I have a list of instagram url's in a excel sheet and i need to extract their user names into another column using a formula.

I have used this formula but it's incomplete and does not work as i need.

=RIGHT(C111,FIND("/",C111))

For example, how can i extract the user name stack_test from the url https://www.instagram.com/stack_test/ which is in a excel sheet.

If you need user names only then you can do it without formula. You can use Text to Column (Short Cut:Alt + D then E). Select Delimited, In delemeters dialog select Other and use /.

EDIT FILTERXML XPATH argument changed. After doing some research, discovered you can specify "next to last" node, instead of using the LOOKUP function.

If your version of Excel has the FILTERXML function, you can use:

=FILTERXML("<t><s>"&SUBSTITUTE(A1,"/","</s><s>")&"</s></t>","//s[last()-1]")

If you have an older version of Excel, you can use:

=TRIM(RIGHT(SUBSTITUTE(IF(RIGHT(A1,1)="/",LEFT(A1,LEN(A1)-1),A1),"/",REPT(" ",99)),99))

尝试:

=MID(A1,FIND("com/",A1)+4,(SEARCH("^^",SUBSTITUTE(A1,"/","^^",LEN(A1)-LEN(SUBSTITUTE(A1,"/",""))))-(FIND("com/",A1)+4)))

Here is a possible way:

=MID(A1,FIND("/",A1)+1,(FIND("/",A1,FIND("/",A1)+1)-FIND("/",A1))-1)

Another way would be to use:

=SUBSTITUTE(MID(SUBSTITUTE("/"&A1&REPT(" ",6),"/",REPT(",",255)),2*255,255),",","")

Output:

在此处输入图片说明

This works if there are exactly two / in each row, and the username is between them.

Type some_text/username/some_other_text in cell A1.

I broke down the formula in multiple cells to make it more readable, but you can make a one-cell formula:

B1: =FIND("/",A1)

C1: =FIND("/",A1,B1+1)

D1: =MID(A1,B1+1,C1-B1-1) . This will show username

If there can be multiple / and you only need the last two, it is more complicated. You might want to have a look:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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