ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Trying to use IF statement with hyphen (https://www.excelbanter.com/excel-worksheet-functions/142717-trying-use-if-statement-hyphen.html)

AmytDev

Trying to use IF statement with hyphen
 
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

Dave Peterson

Trying to use IF statement with hyphen
 
Maybe...

=if(mid(data!$i$2,3,1)="-","",data!$i$2)

AmytDev wrote:

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


--

Dave Peterson

Peo Sjoblom

Trying to use IF statement with hyphen
 
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)


--
Regards,

Peo Sjoblom



"AmytDev" wrote in message
...
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




AmytDev

Trying to use IF statement with hyphen
 
That was awesome! This worked out perfectly. Thank you so Much!
Amy

"Peo Sjoblom" wrote:

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)


--
Regards,

Peo Sjoblom



"AmytDev" wrote in message
...
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






All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com