Find text and enter in new cell

T

tommcbrny

Text in column A cells may contain 1 of the following: alpha, beta, gamma,
delta.

I want to search cells in column A for all of these values and, if one is
found, insert that value in the same cell of column B.

For example, cell A3 contains beta, kappa, and tau. I want to check for
alpha, beta, gamma, or delta. The search should determine that beta is
present and then place beta in cell B3.

If the search does not find alpha, beta, gamma, or delta, then "other"
should be placed in the corresponding cell of column B.

Is this possible?

Thanks,
Tom
 
K

KC Rippstein hotmail com>

=if(countif(a1,"*alpha*")>0,"alpha",if(countif(a1,"*beta*")>0,"beta",if(countif(a1,"*gamma*")>0,"gamma",if(countif(a1,"*delta*")>0,"delta","other"))))
 
T

tommcbrny

Awesome, thank you!

KC Rippstein said:
=if(countif(a1,"*alpha*")>0,"alpha",if(countif(a1,"*beta*")>0,"beta",if(countif(a1,"*gamma*")>0,"gamma",if(countif(a1,"*delta*")>0,"delta","other"))))
 
T

tommcbrny

Folllow-up question to this, although the solution works quite nicely:
Is the number of iterations of the if statements limited?
Thanks again
Tom
 
R

Ron Rosenfeld

Text in column A cells may contain 1 of the following: alpha, beta, gamma,
delta.

I want to search cells in column A for all of these values and, if one is
found, insert that value in the same cell of column B.

For example, cell A3 contains beta, kappa, and tau. I want to check for
alpha, beta, gamma, or delta. The search should determine that beta is
present and then place beta in cell B3.

If the search does not find alpha, beta, gamma, or delta, then "other"
should be placed in the corresponding cell of column B.

Is this possible?

Thanks,
Tom

Enter your allowed words in some column, one word to a cell, and name that
range "List".

Then enter this "array-entered" formula in B1, and fill down as far as
required:

=IF(SUM(-ISNUMBER(SEARCH(List,A1)))=0,"Other",
INDEX(List,MATCH(TRUE,ISNUMBER(SEARCH(List,A1)),0)))

To **array-enter** a formula, after typing or pasting the formula into the
formula bar, confirm it by holding down <ctrl><shift> while you hit <enter>.
Excel will place braces {...} around the formula if you did it correctly.

List can be any size, so long as it is in a single column.
--ron
 

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