ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Extract from string (https://www.excelbanter.com/excel-discussion-misc-queries/103727-extract-string.html)

mark

Extract from string
 
Hi All,
I want to be able to extract some text from various strings and place
it in the cell(s) to the right.
I'm looking for combinations of Ad or Con or both Ad and Con
similar to the following examples say in F3
"Wants Ad,Die" or "Wants Con,Die"
I want to be able to extract out the Ad or Con and place into G3
for Ad or H3 for Con

"Wants Ad,Con,Die"
I want to be able to extract out Ad,Con and place into I3

With this I'll be able to see who wants Ad only, Con only and Ad and
Con combined.
Some of the strings do not have Ad or Con at all.

Thank you
Mark


Niek Otten

Extract from string
 
Hi Mark,

In G3:
=IF(I3="",IF(ISERROR(FIND("ad",F3)),"","ad"),"")
In H3:
=IF(I3="",IF(ISERROR(FIND("con",F3)),"","con"),"")
In I3:
=IF(OR(ISERROR(FIND("ad",F3)),ISERROR(FIND("con",F 3))),"","ad, con")

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"mark" wrote in message oups.com...
| Hi All,
| I want to be able to extract some text from various strings and place
| it in the cell(s) to the right.
| I'm looking for combinations of Ad or Con or both Ad and Con
| similar to the following examples say in F3
| "Wants Ad,Die" or "Wants Con,Die"
| I want to be able to extract out the Ad or Con and place into G3
| for Ad or H3 for Con
|
| "Wants Ad,Con,Die"
| I want to be able to extract out Ad,Con and place into I3
|
| With this I'll be able to see who wants Ad only, Con only and Ad and
| Con combined.
| Some of the strings do not have Ad or Con at all.
|
| Thank you
| Mark
|



mark

Extract from string
 
Niek,
works great thank you
Mark
Niek Otten wrote:
Hi Mark,

In G3:
=IF(I3="",IF(ISERROR(FIND("ad",F3)),"","ad"),"")
In H3:
=IF(I3="",IF(ISERROR(FIND("con",F3)),"","con"),"")
In I3:
=IF(OR(ISERROR(FIND("ad",F3)),ISERROR(FIND("con",F 3))),"","ad, con")

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"mark" wrote in message oups.com...
| Hi All,
| I want to be able to extract some text from various strings and place
| it in the cell(s) to the right.
| I'm looking for combinations of Ad or Con or both Ad and Con
| similar to the following examples say in F3
| "Wants Ad,Die" or "Wants Con,Die"
| I want to be able to extract out the Ad or Con and place into G3
| for Ad or H3 for Con
|
| "Wants Ad,Con,Die"
| I want to be able to extract out Ad,Con and place into I3
|
| With this I'll be able to see who wants Ad only, Con only and Ad and
| Con combined.
| Some of the strings do not have Ad or Con at all.
|
| Thank you
| Mark
|




All times are GMT +1. The time now is 02:22 PM.

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