If Cell Contains Text return a value

russborup

New Member
Joined
May 2, 2018
Messages
23
Hello All

I receive an excel file where a cell would contain a series of acronyms separated by a comma.
Is there a formula that will return a result if a portion of a cell equals the query, or will I just have to stick with text to columns and then an if(or statement.

Example:

ABC
1AB,CNS,RDSH,BTBC
2
3

<tbody>
</tbody>
iF A1 CONTAINS "CNS' RETURN A VALUE OF "Y"

I would appreciate any assistance

Russ
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Maybe like...

Excel 2010
ABC
1My DataQueryFound?
2AB,CNS,RDSH,BTBCCNSY

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
C2=IF(SEARCH(B2,A2),"Y","")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Hi,

C1 is hard-coding the criteria in the formula, F2 uses a cell reference for the criteria:


Book1
ABCDEF
1AB,CNS,RDSH,BTBCYFind WhatResult
2CNSY
Sheet112
Cell Formulas
RangeFormula
C1=IF(ISNUMBER(SEARCH("CNS",A1)),"Y","N")
F2=IF(ISNUMBER(SEARCH(E2,A1)),"Y","N")
 
Last edited:
Upvote 0
Thank you!!!
Sheet7

AB
1AB,CNS,RDSH,BTBCY

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:127px;"><col style="width:64px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
B1=IF(ISNUMBER(FIND("CNS",A1)),"Y","N")

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Thank you!
Hi,

C1 is hard-coding the criteria in the formula, F2 uses a cell reference for the criteria:

ABCDEF
1AB,CNS,RDSH,BTBCYFind WhatResult
2CNSY

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet112

Worksheet Formulas
CellFormula
C1=IF(ISNUMBER(SEARCH("CNS",A1)),"Y","N")
F2=IF(ISNUMBER(SEARCH(E2,A1)),"Y","N")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
You're welcome.

Just to point out a couple of things.

The FIND function is case-sensitive.
Without the ISNUMBER check, if the Criteria is Not found, the formula will Error out.
 
Upvote 0
We do not know your data, but one thing to watch out for with the solutions provided above is a query for an acronym that can also be found within a longer acronym. For example (and this is completely made up to show you the possible problem), if you search for the AB acronym but your cell contained something like this...

CAB,XYZ,MYP

If you searched just for AB, it will be found because it exists as part of the CAB acronym. If your data could have such embedded acronyms, then you will need to use this formula instead...

=IF(ISNUMBER(SEARCH(","&B2&",",","&A2&",")),"Y","")
 
Last edited:
Upvote 0
Thank you!
This does help as my Data for this issue is evolving.
We do not know your data, but one thing to watch out for with the solutions provided above is a query for an acronym that can also be found within a longer acronym. For example (and this is completely made up to show you the possible problem), if you search for the AB acronym but your cell contained something like this...

CAB,XYZ,MYP

If you searched just for AB, it will be found because it exists as part of the CAB acronym. If your data could have such embedded acronyms, then you will need to use this formula instead...

=IF(ISNUMBER(SEARCH(","&B2&",",","&A2&",")),"Y","")
 
Upvote 0

Forum statistics

Threads
1,214,413
Messages
6,119,374
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top