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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
12,713
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
Can there be more than one occurrence of the word in either column?
 
Upvote 0

seguin85

Active Member
Joined
Mar 17, 2015
Messages
278
Office Version
  1. 365
Platform
  1. Windows
This should work:
Code:
=IF(COUNTIF(B2:C2,"*"&"apple"&"*")>0,"yes","no")
Where B2 is column 1 and C2 is column 2
 
Upvote 0

psdileep

New Member
Joined
Mar 15, 2014
Messages
10
Yes. There is possibility of having the word in either of the columns or in both the columns.
 
Upvote 0

psdileep

New Member
Joined
Mar 15, 2014
Messages
10
This formula didn't work. I didn't get desired result.
 
Upvote 0

seguin85

Active Member
Joined
Mar 17, 2015
Messages
278
Office Version
  1. 365
Platform
  1. Windows
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

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
12,713
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
It looks like seguin85's formula should work.
 
Upvote 0

Ryan C

New Member
Joined
Oct 14, 2015
Messages
8
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

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
7,245
Office Version
  1. 2016
Platform
  1. Windows
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

Ryan C

New Member
Joined
Oct 14, 2015
Messages
8
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,191,312
Messages
5,985,924
Members
439,988
Latest member
JDayco

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
Top