ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF a cell contains specific text (https://www.excelbanter.com/excel-discussion-misc-queries/176295-if-cell-contains-specific-text.html)

Christine

IF a cell contains specific text
 
Is there a way to include in a formula a command that will check if a cell
contains a specific string of text? For example, if cell G4 contains "Not
mapped" (and more text), then "Disregard" will be indicated in cell C4 -
IF(G4 contains "Not mapped","Disregard","Something else")

ExcelBanter AI

Answer: IF a cell contains specific text
 
Here's the formatted text in BBCode:

Yes, you can use the IF function along with the SEARCH or FIND function to check if a cell contains a specific string of text. Here's an example formula:
  1. =IF(ISNUMBER(SEARCH("Not mapped",G4)),"Disregard","Something else")

In this formula, the SEARCH function looks for the text "Not mapped" within cell G4. If it finds it, it returns the starting position of the text. The ISNUMBER function then checks if the SEARCH function returned a number (i.e. the text was found). If it did, the IF function returns "Disregard". If not, it returns "Something else".

Note that the SEARCH function is case-insensitive, meaning it will find "not mapped" or "Not Mapped" as well. If you want a case-sensitive search, use the FIND function instead.

Let me know if you need any further assistance.

Don Guillett

IF a cell contains specific text
 

Look in the help index for FIND & SEARCH. Then use within an IF formula
if(0,1,2)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Christine" wrote in message
...
Is there a way to include in a formula a command that will check if a cell
contains a specific string of text? For example, if cell G4 contains "Not
mapped" (and more text), then "Disregard" will be indicated in cell C4 -
IF(G4 contains "Not mapped","Disregard","Something else")



Roger Govier[_3_]

IF a cell contains specific text
 
Hi Christine
Try
=IF(ISNUMBER(SEARCH("Not Mapped",G4)),"Disregard","Something Else")

Search is not case sensitive, so "not mapped" would be found as well.
FIND() is case sensitive, so substitute that if you want a case sensitive
search

You nee the ISNUMBER() function as well, because both Search and Find return
the position on the string, an will give a #N/A error if the string is not
found.

EXACT() tests to see if the string is exactly the same, and returns True or
False, so the Isnumber part would not be needed.
=IF(EXACT("NOt MaPPed",G7),"Disregard","Something Else")
would look for the mixture of upper case and lower case letters in the cell
being exactly the same as type in the formula.
--
Regards
Roger Govier

"Christine" wrote in message
...
Is there a way to include in a formula a command that will check if a cell
contains a specific string of text? For example, if cell G4 contains "Not
mapped" (and more text), then "Disregard" will be indicated in cell C4 -
IF(G4 contains "Not mapped","Disregard","Something else")



Christine

IF a cell contains specific text
 
I LOVE Excel! Thank you very much, Mr. Guillett.

"Don Guillett" wrote:


Look in the help index for FIND & SEARCH. Then use within an IF formula
if(0,1,2)

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Christine" wrote in message
...
Is there a way to include in a formula a command that will check if a cell
contains a specific string of text? For example, if cell G4 contains "Not
mapped" (and more text), then "Disregard" will be indicated in cell C4 -
IF(G4 contains "Not mapped","Disregard","Something else")




Bob I

IF a cell contains specific text
 
Perhaps use this?
=IF(ISERR(FIND("Not mapped",G4)),"Something else","Disregard")

Christine wrote:

Is there a way to include in a formula a command that will check if a cell
contains a specific string of text? For example, if cell G4 contains "Not
mapped" (and more text), then "Disregard" will be indicated in cell C4 -
IF(G4 contains "Not mapped","Disregard","Something else")



Ron Coderre

IF a cell contains specific text
 
Try this:

=IF(COUNTIF(G4,"*Not mapped*"),"Disregard","Something else")

Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Christine" wrote in message
...
Is there a way to include in a formula a command that will check if a cell
contains a specific string of text? For example, if cell G4 contains "Not
mapped" (and more text), then "Disregard" will be indicated in cell C4 -
IF(G4 contains "Not mapped","Disregard","Something else")





All times are GMT +1. The time now is 03:24 AM.

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