Forum Discussion

RubenZh's avatar
RubenZh
Copper Contributor
Aug 20, 2020

Help with if function to deleted characters if met criteria

Hi guys,

 

I'm working with a data set where have a lot of website links. The thing is that most of the links are personalized. For example https://this/testing?wvideo=9gpspqefxd


What I need is to delete all the characters after the question mark (
?) so that I would look like this:

https://this/testing

 

I've already figured out the function to delete that which is =LEFT(A1,FIND("?",A1)-1). However, in the list, of websites, there are also links that don't have the question mark (?), therefore, when I apply the formula to all cells, the ones that don't have the (?) show me as #VALUE! 

 

I thought of using an IF function but I've been struggling to make it work. This is the formula:

=IF(M2="?","(LEFT(M2,FIND("?",M2)-1))","M2")

 

It is supposed to find in A1 the character (?), and after the condition is met, it should do the rest but doesn't work.

 

I appreciate it if you can help me.

 

Thank you!

 

1 Reply

Resources