Advanced Filters and between condition

Today, we want to learn how advanced fil­ters work in Excel, espe­cial­ly between conditions. 

Advanced Fil­ters and between condition

Let’s start. When we have our dataset, we write our advanced fil­ter con­di­tions in cells. We need to have a head­er and a con­di­tion for this head­er. If we write con­di­tions in one row, all of them are con­nect­ed with the final cri­te­ria. It means that each con­di­tion should be met in order to take out the whole row from our dataset (1). When we add con­di­tions to fur­ther rows, it meas that it’s an ‘or’ con­di­tion (2). In this case, we will look for straw­ber­ries or plums. If we want to cre­ate a between con­di­tion, we need to write the head­er two times (3) in order to cre­ate a com­mon part. In our case, we are look­ing for straw­ber­ries that are equal or greater than 500 and small­er or equal to 750, and in the case of plums we want the plums that are equal or greater than 300 and small­er or equal to 500. We have to remem­ber that those con­di­tions should make a com­mon part (Fig. 1)

Dataset with two headers
Fig. 1 Dataset with two headers

When we want to go to advanced fil­ters, we need to select one cell in our dataset (1), then go to the Data tab (2), then Advanced fil­ters (3). In the Advanced fil­ter win­dow press the Copy to anoth­er loca­tion radio but­ton (4), and select the cri­te­ria range (5). The last step is select­ing the tar­get cell, which will be cell E6 (6) (Fig. 2)

 Creating a table
Fig. 2 Cre­at­ing a table

Remem­ber that if con­di­tions are writ­ten in one row, they are com­bined as an ‘and’ con­di­tion, and when they are in sep­a­rate rows, they are com­bined as an ‘or’ con­di­tion. More­over, we can add an emp­ty con­di­tion for dif­fer­ent head­ers. But, since there isn’t any con­di­tion in the Date col­umn, we can select the range with­out it. In fig­ure 3, we can see the final table with sales of plums that are between 300 and 500 and sales of straw­ber­ries that are between 500 and 750, togeth­er with all pos­si­ble dates for those con­di­tions (Fig. 3)

 Final table
Fig. 3 Final table

https://www.youtube.com/watch?v=PihjS8Bq-vI&t

Advanced Filters and wildcards

Today, we want to learn how wild­cards work with advanced filters. 

Advanced Fil­ters and wildcards

First of all, we have to remem­ber that an aster­isk replaces any text string, even an emp­ty one. A ques­tion mark replaces any sin­gle char­ac­ter. A tilde dis­ables a wildcard. 

Let’s start with find­ing ‘Red’ in the Prod­uct col­umn. To do that, we have to select one cell in our data, then go to the Data tab (1) and click on the Advanced fil­ter com­mand (2). In the Advanced fil­ter win­dow, we have to select the Copy to anoth­er loca­tion radio but­ton (3), then write the Cri­te­ria range (4). In the Copy to bar, we select our tar­get cell (5).

Advanced filter window
Fig. 1 Advanced fil­ter window

After press­ing OK, we have our results. In advanced fil­ters, we don’t have a sim­ple con­di­tion with text. This con­di­tion is not an equal con­di­tion, but a ‘starts with’ con­di­tion. In our tar­get col­umn, we have the ‘red’ word, how­ev­er, advanced fil­ters chose whole cells that start with ‘red’. If we want only the exact word, we have to write it with a sin­gle quote, then equals, then our word. Let’s write it. We should make anoth­er advanced fil­ter, so let’s make the same steps as in the pre­vi­ous exam­ple, start­ing with the Data tab and chang­ing the Cri­te­ria range to anoth­er col­umn (1) (Fig. 2)

Advanced filters with an exact word
Fig. 2 Advanced fil­ters with an exact word

In the tar­get cell, we can see only one cell with Drag­on­Fly, even though there are three cells with Drag­on­Fly in our data. 

Now, let’s try the aster­isk option. We write an aster­isk before ‘bee­tle’, but we have to remem­ber that it is always con­nect­ed with the ‘starts with’ option. We are work­ing with wild­cards as well as with the ‘starts with’ cri­te­ria. It works as if an aster­isk was also at the end of ‘bee­tle’. Let’s make a prop­er advanced fil­ter for this case star­ing with the Data tab and chang­ing the Cri­te­ria range into anoth­er col­umn (1) (Fig. 3)

 Advanced filters with an asterisk
Fig. 3 Advanced fil­ters with an asterisk

As we can see, ‘bee­tle’ can be at the end, at the begin­ning or even in the mid­dle of our cell.

Now, let’s work with ques­tion marks. We need to remem­ber that one ques­tion mark rep­re­sents only one sign. It can be a dig­it, a let­ter or any oth­er sign. For exam­ple ‘Ant ? — ? mm’ can­not rep­re­sent ‘Ant 6 — 10 mm’, because there are too many signs in 10. Let’s make an advanced fil­ter for that. We start with the Data tab, and we change the Cri­te­ria range (1) and the tar­get cell (2) (Fig. 4)

Advanced filters with an asterisk
Fig. 4 Advanced fil­ters with an asterisk

We can see that we found two cells where a ques­tion mark rep­re­sent­ed only one sign. 

Now, let’s move on to a tilde. We want to find the exact phrase of ‘*Ant’. That’s why we put a tilde at the begin­ning. If we put only an aster­isk and an Ant, like this ‘*Ant’, Excel would find any Ant, regard­less of its posi­tion. The tilde makes the aster­isk stop being a wild­card. We do the same as in pre­vi­ous cas­es, chang­ing only the Cri­te­ria range and the tar­get cell (Fig. 5)

 Advanced filters with a tilde
Fig. 5 Advanced fil­ters with a tilde

We can see that Excel found only one Ant with an aster­isk at the begin­ning. It’s because we turned off wildcards. 

https://www.youtube.com/watch?v=oRH3-S9v-8Q