问题
I have simple problem. I was analyzing some data and came up with this problem.
Below is my value in a colomn:
www.mysite.come/api/Customer?id=12333&name=jack
www.mysite.come/api/Department?id=52365&name=COP
www.mysite.come/api/Customer?id=13333&name=mathew
etc
I want to filter this data something like this
www.mysite.come/api/Customer
www.mysite.come/api/Department
www.mysite.come/api/Customer
Please help me with this.
回答1:
If its just as simple as removing everything after, including, the ?
then this will do it:=LEFT(A:A,FIND("?", A1)-1)
Edit: If you want to catch the #VALUE!
error when there is no ?
simply use IFERROR
:=IFERROR(LEFT(A:A,FIND("?", A1)-1), A1)
Example rows:
www.mysite.come/api/Customer?id=12333&name=jack
www.mysite.come/api/Department?id=52365&name=COP
www.mysite.come/api/Customer?id=13333&name=mathew
Output:
www.mysite.come/api/Customer
www.mysite.come/api/Department
www.mysite.come/api/Customer
回答2:
I think you need to use a combination of FIND
and LEFT
.
For example (where A1 contains your original value)
=LEFT(A1, FIND("?", A1) -1)
回答3:
The significance of your mention of filter is not clear to me but you might copy your data into another column, select the latter column and with Find/Replace Find what:
~?*
Replace All.
回答4:
Its a good idea to handle when when the column doesn't contain the "?". To do this use the ISERROR() function as follows:
=LEFT(A2, IF(ISERROR(FIND("?",A2))=TRUE,LEN(A2), (FIND("?",A2)-1)))
来源:https://stackoverflow.com/questions/28765618/delete-the-string-after-the-delimiter-in-excel