Question: How do I filter common values between two ranges using array formula in excel?

Answer:

common-values-in-range-one-and-two

Formula in B12:

=INDEX(One, MIN(IF((COUNTIF(Two, One)>0)+COUNTIF(B12:$B$12, One)=1, ROW(One)-MIN(ROW(One))+1, "")), MATCH(0, NOT(COUNTIF(Two, INDEX(One, MIN(IF((COUNTIF(Two, One)>0)+COUNTIF(B12:$B$12, One)=1, ROW(One)+1, ""))-MIN(ROW(One)), , 1)))+COUNTIF(B12:$B$12, INDEX(One, MIN(IF((COUNTIF(Two, One)>0)+COUNTIF(B12:$B$12, One)=1, ROW(One)+1, ""))-MIN(ROW(One)), , 1)), 0)) + CTRL + SHIFT + ENTER copied down as far as necessary.

Named ranges
One (B2:D4)
Two (B7:E10)
What is named ranges?

How to implement array formula to your workbook
Change named ranges. If your list starts at, for example, F2. Change B12:$B$12  in the above formulas to F1:$F$1.

Download excel example file.
Filter common values from two ranges.xls
(Excel 97-2003 Workbook *.xls)

Functions in this article:

IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range

SMALL(array,k) Returns the k-th smallest row number in this data set.

NOT(logical)
Changes FALSE to TRUE or TRUE to FALSE

MATCH(lookup_value;lookup_array; [match_type]
Returns the relative position of an item in an array that matches a specified value

INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range

COUNTIF(range,criteria)
Counts the number of cells within a range that meet the given condition

MIN(number1,[number2])
Returns the smallest number in a set of values. Ignores logical values and text

This blog article is one out of five articles on the same subject.

  • Share/Bookmark

Related posts:

  1. Filter common text values in range 1 and in range 2 using array formula in excel
  2. Filter common values from three columns in excel
  3. Filter text values existing in range 1 but not in range 2 using array formula in excel
  4. Filter values existing in range 1 but not in range 2 using array formula in excel
  5. Filter unique values from a range using array formula in excel
  6. Filter unique distinct text values using “begins with” criterion in a range using array formula in excel
  7. Filter unique distinct list sorted based on sum of adjacent values using array formula in excel
  8. Filter unique rows and sort by date using array formula in excel
  9. Filter duplicate rows and sort by date using array formula in excel
  10. Filter unique distinct values from two ranges combined in excel 2007