Search for pattern in two columns

arvindsaraswat

New Member
Joined
Feb 12, 2013
Messages
13
I have a huge excel (running into 10k+ rows). The first row is title row.

I want to search for "Some text here : xxx" string in two columns (AA, BA) where xxx can be YES or NO or ??? or blank. This is not nicely formatted, so we can assume some text immediately after YES or NO Strings. Also, YES & NO are case insensitive.

Examples:
Some text here : YES
Some text here : Yesxxssdasf
Some text here : Yes sdfsd 342342 sdfsdfgSome text here : NO
Some text here : nozxsds

If the "Some text here : Yes" is present in AA or BA or both, mark column CA as "PRESENT". In all other cases, mark it as "ABSENT".
 

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.
Hi, do you mean something like this maybe:


Excel 2013/2016
AAABAC
1Some text here : YESPRESENT
2Some text here : YesxxssdasfSome text here : YesxxssdasfPRESENT
3Some text here : Yes sdfsd 342342 sdfsdfgSome text here : NOPRESENT
4Some text here : nozxsdsSome text here : nozxsdsABSENT
5Some text here : nozxsdsSome text here : YESPRESENT
Sheet1
Cell Formulas
RangeFormula
AC1=IF(ISNUMBER(LOOKUP(1,-SEARCH(": yes",AA1:AB1))),"PRESENT","ABSENT")
 
Upvote 0
This seems to work. How to handle:
1. what if there is no space after ":" character (:YES, : yes ...)
2. My columns are AA and BA (this I have fixed by changing AA1:AB1 range accordingly). Though I dont want to search for intermediate columns.
 
Upvote 0
Hi,

1. How about we just search for "yes".
2. I'd assumed that was a typo :oops: - how about this:

=IF(OR(ISNUMBER(SEARCH("yes",AA1)),ISNUMBER(SEARCH("yes",BA1))),"PRESENT","ABSENT")
 
Upvote 0
Excellent.. thats what I have done now.

While parsing, I found that someone has use "true" for "Yes"... so now I can extend it easily.

Thanks a lot.
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,834
Members
452,674
Latest member
psion2600

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