Excel根据不同列进行OR条件过滤
Multiple criteria, multiple columns, any criteria true
Boolean logic: (Type = "Produce" OR Salesperson = "Buchanan")
- Insert at least three blank rows above the list range that can be used as a criteria range. The criteria range must have column labels. Make sure that there is at least one blank row between the criteria values and the list range.
The example may be easier to understand if you copy it to a blank worksheet.
- Create a blank workbook or worksheet.
- Select the example in the Help topic.
Note Do not select the row or column headers.
Selecting an example from Help
- Press CTRL+C.
- In the worksheet, select cell A1, and press CTRL+V.
- To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
|
|
- To find rows that meet multiple criteria in multiple columns, where any criteria can be true, type the criteria in the different columns and rows of the criteria range. In the example, you would enter:
|
A |
B |
C |
1 |
Type |
Salesperson |
Sales |
2 |
="=Produce" |
|
|
3 |
|
="=Buchanan" |
|
- Click a cell in the list range. In the example, you would click any cell in the list range, A6:C10.
- On the Data tab, in the Sort & Filter group, click Advanced.
- Do one of the following:
- To filter the list range by hiding rows that don't match your criteria, click Filter the list, in-place.
- To filter the list range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows.
Tip When you copy filtered rows to another location, you can specify which columns to include in the copy operation. Before filtering, copy the column labels for the columns that you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.
- In the Criteria range box, enter the reference for the criteria range, including the criteria labels. In the example, you would enter $A$1:$B$3.
To move the Advanced Filter dialog box out of the way temporarily while you select the criteria range, click Collapse Dialog .
- In the example, the filtered result for the list range would be:
|
A |
B |
C |
6 |
Type |
Salesperson |
Sales |
9 |
produce |
Buchanan |
$6,328 |
10 |
Produce |
Davolio |
$6,544 |