Filtering By Multiple Fields Using Excel Macros


 icon vba

The methodology of the language Visual Basic is very dynamic when performing functions within spreadsheets, among these examples, is the ability to filter multiple fields using macros within the same table.

This method in turn can also be achieved through the header of Microsoft Excel , but without the ability to make a modification as advanced as in VBA.

< meta itemprop = "uploadDate" content = "2020-12-06T14: 00: 11Z">
How Filter by Multiple Fields using Excel Macros

< noscript> C & oacute; mo Filter By M STILL Excel Macros Using multiple fields
Watch this video on YouTube

You may also be interested in:

You stop worrying, because we understand that is a code difficult to understand, but you found the right place with the easiest directions to achieve. In this case used as an example a table of seven columns with data and prices a store.

Filter Method for multiple fields using macros

To begin performing this function method « AutoFilter » that lets you create a filter for a table or field through two criteria will be used.

In this case you need to apply the effect in more than one field. It is necessary to apply the method in the same amount of fields you want to filter simultaneously.

What is desired set through criteria is basically define what type of information will be shown and what is hidden under the criteria that are placed in the code .

Instructions step by step with AutoFilter

In Microsoft Excel 2013 can be found in the header tab « Developer » in which you do click to find the option « Visual Basic

green excel

Once you have entered the code editor on the book project an icon will show the option to create a new « Block » which must press.

On your screen a white sheet on which you begin to write your macro code as follows is displayed.

Begin by naming your macro, in this case will be « Multiple filter » accompanied by two brackets.

An advantage of the AutoFilter method is that you just select the letter and number of the cell in the first rank to this end to cover the rest of the field.

For the first filter will be used as range cell A1 in the first sheet of the code, accompanied by the term « AutoFilter «. The next step is to indicate AutoFilter parameters, among which are the following terms:

  • The field will be set as the column for which you want the filter is made. For example, the second.
  • The first criterion is the term by which the filter will apply to begin to show or hide the data, accompanied by « Visibledropdown: = False «.

Add a new column to the macro code

Because you are trying to filter multiple fields using macros, the second criterion you must set your VBA code is the next column in which the filter will make its effect.

Thus repeat the step of establishing another filter within « Sub » placing the same characteristics sheet, only by changing the following terms:

  • The next field or column where you want the filter is made. For example, the fifth.
  • The first criterion of this second filter is set to the parameter in which the summary data is performed.
  • Includes the term « Operator » to define the term by which the content is filtered.
  • Finally, culminates the creation of this second filter by replacing « Visibledropdown: = False «.

In this way get filter multiple fields using macros, in this case between two fields belonging to your table of contents.

 logo excel in pc

To test if it works, you just have to minimize the editor and re-access the tab « Developer » to find the option « Macros

Select the title of the macro code you just created. Push the button of « Run » displayed on the right side of the window.

So you can appreciate how automatically the rest of the content is hidden and appear only data that fit within the parameters of your criteria.

Protect your important documents, and if in this case your spreadsheets have important information you should know you can protect them and remove protection at will.

Once your tables and Excel spreadsheets are ready’ll save power without any problems. You have the choice of convert your Excel spreadsheets to HTML or vice versa can spend a PDF file to Excel.

Maybe after you look at the need to print so do not worry of you can do it easily and without damaging your work.

How useful did you find this content?

Click on a star to rate!

Average score 0 / 5. Counting of votes: 0

So far, no votes. Be the first to rate this content.

I'm sorry this content was not useful for you!

Let me improve this content!

Tell me, how can I improve this content?

You may also be interested in:

Deja un comentario