## Perform thousands of conditions to a data set

This article explains how to filter a data set based on extremely many conditions in an Excel defined Table, in fact, this example has 1500 conditions. So many that it is tedious and time-consuming to enter or click checkboxes in a Filter / Excel Table.

I have all conditions entered in a worksheet and I am going to utilize a formula to apply all conditions at once. This article was created to answer the following question:

**Mohsin Ali Raziq asks:**

I have problem, and o don't know how to solve it, I have data of almost 10000 forms, from which I have to find 1500, so it is very difficult to dig out 1500 one by one through Ctrl+F, is there any way to to put all the forms number at once and then find all those just by clicking. the primary key is Form Number.

The "Data" worksheet contains the form numbers in column A, the remaining columns contain dummy data.

The next sheet "Search values" contains the 1500 form numbers you want to use as conditions.

### Convert data set to an Excel defined Table

I will convert the data, in this example, to an Excel defined Table. You can also use an Excel Filter if you prefer that.

- Select any cell in your data set.
- Press Ctrl + T which is a shortcut for converting data to an Excel defined Table.

- Press OK button.

Excel now applies formatting to your data set indicating it is now an Excel defined Table.

### Search form numbers

It is now time to enter the formula, it will be automatically copied to cells below by the Excel defined Table. This is great saving us a little bit of time.

Formula in cell G2:

Make sure you use absolute cell references. The COUNTIF function counts the number of values in cell range 'Search values'!$A$2:$A$1501 that is equal to the value in column #. Here is the function syntax:

COUNTIF(*range*, *criteria*)

It returns 1 if the value in column # is found in the cell range containing conditions and 0 (zero) if not found. If there is more than one instance of a value in 'Search values'!$A$2:$A$1501 the formula may return a value greater than 1.

### Filter table

The Excel defined Table lets you select which values you want to filter, there is now only 1 or 0 (zero) to choose from which is much easier to base a filter on than 1500 different conditions.

- Click the black arrow at the top in column G which is the same column you entered the formula in.
- Make sure only 1 is selected since this indicates that the value on the same row in column # is equal to one of the 1500 conditions specified in cell range 'Search values'!$A$2:$A$1501.

- Press OK button to apply the filter.

Below is a picture of the filtered Excel defined Table containing the 1500 form numbers,

### Recommended articles

Vlookup a cell range and return multiple values

VLOOKUP a multi-column range and return multiple values.

Vlookup a cell range and return multiple values

Extract all rows that contain a value between this and that

Question: I have a list and I want to filter out all rows that have a value (Column C) that […]

Extract all rows that contain a value between this and that

Match two criteria and return multiple records

Question: I have a table of 3 columns (Security name, date, price) and I have to find the price of […]

Match two criteria and return multiple records

This article describes how to filter duplicate rows with the use of a formula. It is, in fact, an array […]

Filter unique distinct records

Table of contents Filter unique distinct row records Filter unique distinct row records but not blanks Filter unique distinct row […]

How to use an Excel Table name in Data Validation Lists and Conditional Formatting formulas

This article demonstrates different ways to reference an Excel defined Table in a drop-down list and Conditional Formatting. There are […]

Extract unique distinct values from a filtered Excel defined Table [UDF and Formula]

Robert Jr asks: Oscar, I am using the VBA code & FilterUniqueSort array to generate unique lists that drive Selection […]

Count unique distinct values in a filtered Excel defined Table

This article demonstrates a formula that counts unique distinct values filtered from an Excel defined Table. Debra Dalgleish described in […]

Remove common records between two data sets

This article demonstrates how to filter records occurring in only one out of two Excel defined tables. It also shows […]

Populate drop down list with filtered Excel Table values

This article demonstrates how to populate a drop down list with filtered values from an Excel defined Table. The animated […]

Copy filtered Excel tables [VBA]

Today I want to share some pretty useful macros. My first macro copies an excel defined table with vba. It is […]

Hide specific columns programmatically

This article describes a macro that hides specific columns automatically based on values in two given cells. I am also […]

Highlight duplicates in a filtered Excel Table

The image above demonstrates a conditional formatting formula applied to an Excel Table containing random data. The Excel Table has […]

Copy Excel Table filter criteria programmatically

I will in this article demonstrate a macro that copies criteria from one Excel Table and applies them to another […]

This article demonstrates how to filter duplicate records using a simple formula and an Excel defined table.

### 2 Responses to “Perform thousands of conditions to a data set”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

what isthe [@['#]] that you type inside the countif formula ?

Douglas Rezende

It is a structured reference used in Excel defined Tables.

The @ character references cells on the same row as the formula.

The '# is the name of the column, not the greatest column name I admit, considering that # characters are used in structured references as well.

https://www.ablebits.com/office-addins-blog/2019/02/06/structured-references-excel-tables/