ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check if there is a space in a string as test for IF (https://www.excelbanter.com/excel-programming/448354-check-if-there-space-string-test-if.html)

Caveman1957

Check if there is a space in a string as test for IF
 
I need to check if there is a space in a string(Cell) and use the result as a test in an if statement.

I tried using search() but if there is no space there is no result so I get #VALUE in my formula cell.
=IF(SEARCH(" ",G2),{split string at space},"FALSE")

Is there anything I can use that will get me a Boolean true false result that can be used?

Caveman1957

I have found an answer.

If I enclose the search in an ISERR() then it works.

ISERR(SEARCH(" ",G2)) result of this is either TRUE or FALSE.

Claus Busch

Check if there is a space in a string as test for IF
 
Hi,

Am Fri, 8 Mar 2013 14:41:53 +0000 schrieb Caveman1957:

I need to check if there is a space in a string(Cell) and use the result
as a test in an if statement.

I tried using search() but if there is no space there is no result so I
get #VALUE in my formula cell.
=IF(SEARCH(" ",G2),{split string at space},"FALSE")

Is there anything I can use that will get me a Boolean true false result
that can be used?


you can use TextToColumns with space as deliniter. If there is a space
the string will be split.
Or use formula:
=IF(ISNUMBER(FIND(" ",G2)),{split string at space},"False")


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


All times are GMT +1. The time now is 12:21 PM.

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