Excel: How to Create a List Based on Criteria


You can use the following basic formula to create a list based on criteria in Excel:

=IFERROR(INDEX($A$2:$A$12,SMALL(IF($B$2:$B$12=$B$2,ROW($B$2:$B$12)),ROW(1:1))-1,1),"")

This particular formula creates a list of values in the range A2:A12 where the value in the range B2:B12 is equal to the value in cell B2.

The following examples show how to use this formula in practice with the following dataset in Excel:

Example 1: Create List Based on One Criteria in Excel

We can use the following formula to create a list of players who are on the Mavs team:

=IFERROR(INDEX($A$2:$A$12,SMALL(IF($B$2:$B$12=$B$2,ROW($B$2:$B$12)),ROW(1:1))-1,1),"")

We can type this formula into cell E2 and then drag it down to the remaining cells in column E to create a list of players who are on the Mavs team:

Excel create list based on criteria

The result is a list of three players:

  • Andy
  • Bob
  • Frank

We can look at the original dataset to confirm that all three of these players are on the Mavs team.

Example 2: Create List Based on Multiple Criteria in Excel

We can use the following formula to create a list of players who are on the Mavs team and have a position of Guard:

=IFERROR(INDEX($A$2:$A$12,SMALL(IF(($B$2:$B$12=$B$2)*($C$2:$C$12=$C$2),ROW($B$2:$B$12)),ROW(1:1))-1,1),"")

We can type this formula into cell E2 and then drag it down to the remaining cells in column E to create a list of players who are on the Mavs team and have a position of Guard:

Excel create list based on multiple criteria

The result is a list of two players:

  • Andy
  • Frank

We can look at the original dataset to confirm that both of these players are on the Mavs team and have a position of Guard.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

Excel: How to Extract Unique Values Based on Criteria
Excel: How to Randomly Select Cells Based on Criteria
Excel: How to Find Top 10 Values Based on Criteria

3 Replies to “Excel: How to Create a List Based on Criteria”

  1. Great – had to look elsewhere to find out that I needed CRTL-SHIFT ENTER because it’s an array formula. I often forget that.

  2. I’ve been trying to use this formula, but SMALL does not work with TEXT values and the IF within the SMALL function returns a TEXT value, so you end up with a #NUM error

    1. Hi Alex…You’re right! The `SMALL` function only works with numeric values, so trying to use it with text will result in a `#NUM!` error. However, we can achieve the same result using a combination of other functions. Here are some alternative ways to **create a list based on criteria**, even if your data includes text values.

      —

      ### **Approach 1: Use FILTER (for Excel 365 / 2021)**
      If you have access to Excel 365 or 2021, the easiest way to extract a list based on criteria is the `FILTER` function.

      #### Example:
      Assume:
      – Column **A** contains names.
      – Column **B** contains categories.
      – You want to extract all names where the category is “Apples”.

      Formula:
      “`excel
      =FILTER(A2:A100, B2:B100=”Apples”, “”)
      “`

      This will generate a dynamic array containing the names where the category matches “Apples.”

      —

      ### **Approach 2: Use INDEX + MATCH with Helper Column (for Older Excel Versions)**

      If you don’t have access to the `FILTER` function, this method will work. It involves a helper column to assign row numbers that meet the criteria.

      1. **Step 1**: Create a helper column (e.g., Column **C**) with the following formula to assign numbers to matching rows:
      “`excel
      =IF(B2=”Apples”, ROW(), “”)
      “`
      This will return the row number if the category is “Apples” or blank otherwise.

      2. **Step 2**: Use `INDEX` with `SMALL` to extract the corresponding values.

      Formula to extract the first matching name:
      “`excel
      =IFERROR(INDEX(A:A, SMALL(C:C, ROW(1:1))), “”)
      “`
      Drag this formula down to extract all matching values.

      **Explanation**:
      – `SMALL(C:C, ROW(1:1))` finds the smallest row number from the helper column that meets the criteria.
      – `INDEX(A:A, …)` returns the value from the corresponding row in Column A.
      – `IFERROR` handles the case where there are no more matching values.

      —

      ### **Approach 3: Use Array Formula (Older Versions of Excel)**

      If you don’t want to use a helper column, you can directly use an array formula (available in Excel 2019 and earlier).

      Formula:
      “`excel
      =IFERROR(INDEX(A:A, SMALL(IF(B2:B100=”Apples”, ROW(A2:A100)), ROW(1:1))), “”)
      “`

      **How to use**:
      1. Enter the formula as an **array formula** by pressing `Ctrl + Shift + Enter` (on Windows) or `Cmd + Shift + Enter` (on Mac).
      2. Drag the formula down to fill additional cells.

      **Explanation**:
      – `IF(B2:B100=”Apples”, ROW(A2:A100))` creates an array of row numbers where the category is “Apples.”
      – `SMALL(…, ROW(1:1))` picks the smallest row number for the nth match.
      – `INDEX` extracts the corresponding name from Column A.

      —

Leave a Reply

Your email address will not be published. Required fields are marked *