Trying to use IF statement with hyphen

A

AmytDev

I"m struggling with trying to get this function to work.
=IF((LEFT(Data!$I$2,3))="-","",((Data!$I$2)))

If the third character is a hyphen, I want the data in the cell to be blank
otherwise, I want the value of I2 in that cell.

Any ideas?
Amy
 
P

Peo Sjoblom

1. Too many parenthesis
2. LEFT will return what's left of the 3rd character the 3rd character
included
3. What do you want if the I2 is empty?

try

=IF(MID(Data!$I$2,3,1)="-","",Data!$I$2)


if you want a blank if I2 is empty

=IF(OR($I$2="",MID(Data!$I$2,3,1)="-"),"",Data!$I$2)
 
Top