search in multiple columns if a specific value exists

psdileep

New Member
Joined
Mar 15, 2014
Messages
10
I've data in 47000 rows and 20 columns. I've hidden all columns except two from which I need to do analysis.

I need to search in these two columns and identify if a particular string exists in either of the columns and return 'yes' or 'no'.

From the below example, I want to search for "Apple" in Col 1 and Col 2 and in Col 3, I should have row 2 and row 4 are marked as yes (for that matter some remark which says yes). Because 'Apple" can be found in row 2 and row 4.

Any formula or function I can use?

Col 1Col2
Apple is red

<tbody>
</tbody>
I like mangoes

<tbody>
</tbody>
Orange is orange

<tbody>
</tbody>
I am a boy

<tbody>
</tbody>
mango is yellow

<tbody>
</tbody>
I like apples

<tbody>
</tbody>
grapes are purple

<tbody>
</tbody>
I don’t know

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Can there be more than one occurrence of the word in either column?
 
Upvote 0
This should work:
Code:
=IF(COUNTIF(B2:C2,"*"&"apple"&"*")>0,"yes","no")
Where B2 is column 1 and C2 is column 2
 
Upvote 0
Yes. There is possibility of having the word in either of the columns or in both the columns.
 
Upvote 0
Is it formatted like:
ABC
1apple is redi like mangosyes
2orange is orangei am a boyno
3mango is yellowi like applesyes
4grapes are purplei don't knowno

<tbody>
</tbody>

In formula C1 it should be:
Code:
[COLOR=#574123]=IF(COUNTIF(A1:B1,"*apple*")>0,"yes","no")[/COLOR]
The copy this down
 
Upvote 0
It looks like seguin85's formula should work.
 
Upvote 0
I don't think it can be done outside VBA. I've been googling for some time now and cant find a method that allows you to check if a value exists in an array (across multiple columns)
 
Upvote 0
Hi,

Chances are, it can be done with Formula, I've done many, depending on the situation.
As this thread is more than 5 years old, start a new thread with your particular question, I'm sure you'll be able to get some assistance.
 
Upvote 0
That's my bad, while google was almost entirely useless in answering the query without VBA code, turns out the one's I did test didn't work because I accidentally had the wrong range selected.
=countif(array,"*apple*") works, doesn't actually require ctrl+shift+enter either
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,694
Members
448,979
Latest member
DET4492

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