SOLVED

Issue Writing IF Formula

Copper Contributor

Hello All,

 

I am attempting to write a formula with the following logic:

  • If the URL contains a "?" (true), then delete "?" and everything to the right of it.
  • If the URL does not contain a "?" (false), then return the cell unmodified.

 

This is the fomula that I wrote:

=IF(ISNUMBER(SEARCH("?",A2)),LEFT(A2,FIND("?",A2)-1),A2)

Outcome: When true (i.e. "?" is found), the formula successfully returns the URL modified with the "?" and everything to the right deleted. However, when false (i.e. "?" is not found), the formula returns an error and does not return the "false" value that I'm expecting it to. Here's a visual of what I'm experiencing:

ExhibitA.png

 

What am I doing wrong, and what is the correct way to write this formula?

2 Replies
best response confirmed by Neal Vazquez (Copper Contributor)
Solution

Neal,

 

try this:

=IFERROR(LEFT(A2,SEARCH("~?",A2)-1),A2)

Perfect! Thank you!

1 best response

Accepted Solutions
best response confirmed by Neal Vazquez (Copper Contributor)
Solution

Neal,

 

try this:

=IFERROR(LEFT(A2,SEARCH("~?",A2)-1),A2)

View solution in original post