There is a way to do this using Excel native functions. It's a bit awkward, but will work.
If you want to perform a logical test for the presence or absence of a character in a string, FIND and SEARCH will let you down. Both functions return '#VALUE!' if the search string is not found, which in turn blows the results of your logical test. Instead, you can use the LEN and SUBSTITUTE functions to perform your logical test.
I'll use an example of a 'Full Name' column I'm trying to break down into 'First Name' and 'Last Name'. The catch is that my 'Full Name' column is sometimes formatted as 'Lastname, Firstname', and sometimes as 'Firstname Lastname', but I want to parse it cleanly regardless of the format of the original column.
Based on the presence or absence of a comma in the 'Full Name' column, I can reliably break out my desired components most of the time. FIND or SEARCH won't work here, for the reasons above. However, I can use SUBSTITUTE to replace all instances of a comma in my 'Full Name' string with... nothing. Doing so will return a shorter string than the original if any commas are present, and a string the same length as the original if no commas are present. There is no '#VALUE!' result waiting for me here.
So, for the string 'Simpson, Homer' in cell A4:
FIND(",", A4) returns a value of 8
LEN(A4) returns a value of 14
LEN(SUBSTITUTE(A4, ",", "")) returns a value of 13
For the string 'Homer Simpson' in cell A4:
FIND(",", A4) returns '#VALUE!'
LEN(A4) returns a value of 13
LEN(SUBSTITUTE(A4, "," "")) returns a value of 13
So, by comparing the lengths of the strings for your logical test, as below:
Code:
IF(LEN(SUBSTITUTE(A4, ",", ""))=LEN(A4), do_when_comma_is_absent, do_when_comma_is_present)
you get a reliable result without having to bust out the VBA.