Alain
Alain

Reputation: 177

MS Excel, How to make the IF formula spit back the value of the cell if condition is FALSE?

Here is the formula I am trying to run:

=IF((FIND("(",A24)-1),LEFT(A24,FIND("(",A24)-1),A24)

I thought that the last A24 meant that the cell value would be copied if the IF condition is false, but it is not being copied. How would one make that happen? Thanks!

Upvotes: 0

Views: 565

Answers (2)

nbayly
nbayly

Reputation: 2167

The issue you are having is if the formula FIND does not find your search term "(" it will output the error value #VALUE!. To correct this please consider the following formula:

=IF((IFERROR(FIND("(",A24)-1,FALSE)),LEFT(A24,FIND("(",A24)-1),A24)

IFERROR function makes sure if the term is not found it will output FALSE. Hope this helps. Cheers,

Upvotes: 1

kaybee99
kaybee99

Reputation: 4744

The syntax for an if statement is

=IF(condition, value if true, value if false)

You have omitted the optional value if false so if your condition returns false, the statement will return a blank value.

Your current statement will return the value of cell A24 when the condition is true.

Try: =IF((FIND("(",A24)-1),LEFT(A24,FIND("(",A24)-1),value_if_true,A24)

Upvotes: 0

Related Questions