Trying to use IF statement with hyphen

G

Guest

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top