Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel find cells from range where search value is within the cell

Tags:

excel

Once again I'm struggling to find my answer on Google, but I'm sure it must exist. Sorry if I come across as a novice: I am when it comes to Excel it seems!

What I'd like to be able to do is tell it to search a range, then find cells within that range that contain text that is in my search function. I don't need any kind of result from it other than either TRUE or >1 (if it matches, obviously).

In this instance I'm searching a RANGE that is comprised of years, one year in each cell, and trying to find cells in that range that contain a year from a list of years that are all in one cell.

Basically I'm wanting to use a function similar to the Search function I think.

=SEARCH(text to find, find within text)

However, I'd like it to do the opposite and find cells that contain some of the text within the source cell:

=SEARCH(find within text, text to find)

Or, more specifically

=SEARCH("2001,2002,2003,2004,2005", "2003")

Is this possible without the use of a Macro? I'd prefer to avoid it if at all possible. All cells in question are formatted as Text.

I have been experimenting with COUNTIF, but again it works in the reverse of what I need.

Sorry if this question is unclear. Hope someone can help, thanks in advance.

Joe

like image 370
JoeP Avatar asked Nov 27 '12 15:11

JoeP


People also ask

How do you check if a cell value is present in another cell?

You can use the MATCH() function to check if the values in column A also exist in column B. MATCH() returns the position of a cell in a row or column. The syntax for MATCH() is =MATCH(lookup_value, lookup_array, [match_type]) . Using MATCH, you can look up a value both horizontally and vertically.


Video Answer


1 Answers

I'm sure there is a better way, but if I'm understanding correctly, you could try SUM in combination with an array formula (enter with Ctrl+Shift+Enter):

=IF(SUM(IFERROR(FIND(A1:E1,G1),0))>0, "FOUND", "NOT FOUND")

Here, A1:E1 contained the individual years and G1 contained the single cell of years. This runs FIND on each cell in the range, returning a position if it finds a match in the target cell and returning 0 if not (IFERROR is a 2007 function - if you don't have Excel 2007, we can rewrite). You then sum the results of the FIND function and if it is greater than 0, it means you found a match somewhere.

enter image description here

like image 150
RocketDonkey Avatar answered Nov 15 '22 07:11

RocketDonkey