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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With