Reputation: 134
I already searched for formulas or add ins online but can't seem to find any formula for this.
I was wondering if I can remove everything after a question mark in a URL?
to
Thanks!
Upvotes: 7
Views: 10352
Reputation: 2177
For a manual way, use find and replace: find: ~?* replace with: (nothing)
A comment above has the best answer: LEFT(A1,FIND("?",A1)-1)
with the -1 included.
Upvotes: 0
Reputation: 172468
You may try something like this:
=LEFT(A1,FIND("?",A1))
Here A1 is your url
Upvotes: 3
Reputation: 55682
Try
=IF(LEN(SUBSTITUTE(A1,"?",""))=LEN(A1),A1,LEFT(A1,FIND("?",A1)-1))
to
?
not appearing in A1 without raising an errorhttp://www.site.com/index.php
.... your accepted answer doesnt adjust for the position of ?
and it will return http://www.site.com/index.php?
Upvotes: 12
Reputation: 4378
If you want to return another hyperlink, but only cosisting of everything before the question mark, you could use the following formula, having you URL in cell A1
.
=HYPERLINK(LEFT(A1,FIND("?",A1,1)-1))
Upvotes: 3