How to Exclude Values from One Column Based on Values in Another Column in Excel

Prepare two columns for example column A and column B, column A lists some values, and column B lists some values exist in column A but need to be removed from column A. If we want to exclude these matched values from column A, we can use VLOOKUP function or COUNTIF function here to find them out. This article will show you the method to exclude values from one column refer to another column by VLOOKUP and COUNTIF functions.

Precondition:

Prepare a table recording the PASS and FAIL status for students. Now we need to exclude students who are listed in PASS column but also listed in FAIL.

Exclude Values from One Column 1

Method 1: Exclude Values from One Column by VLOOKUP Function


Step 1: Insert a new column between column B and column C. Then in C2 enter the formula

=VLOOKUP(B2,$D$2:$D$6,1,FALSE).

Exclude Values from One Column 2

Step 2: Click Enter. Verify that Ada is displayed in this cell.

Exclude Values from One Column 3

Step 3: Drag down the fill handle. Verify that C2:C11 are filled with returned values of VLOOKUP function.

Exclude Values from One Column 4

Through the screenshot we can see that values need to be removed are displayed in column C.

Step 4: Create a filter on C1. Select row 1, click Data in ribbon, select Filter.

Exclude Values from One Column 5

Step 5: Click arrow button in C1, then Sort & Filter dialog is displayed. Check on Select All option first (this operation will activate all options checked), then uncheck #N/A. Click OK.

Exclude Values from One Column 6

Then values need to be excluded are filtered in column B.

Exclude Values from One Column 7

Step 6: Now you can highlight them or remove them per your request. If you want to highlight them, just select the range marked in red in above screenshot, and click Home->Fill Color button to highlight them.

Exclude Values from One Column 8

If you want to remove them, just copy this column to another worksheet, and then filter text by color.

Exclude Values from One Column 9

Then delete these filtered cells (press F5 to trigger Go To dialog, and then click Special button, check on Visible cells only option and click OK, all visible cells are selected, then you can delete them). Copy and paste updated column to column B again.

Method 2: Exclude Values from One Column by COUNTIF Function


Steps are similar with VLOOKUP function.

Step 1: Insert a new column between column B and column C. Then in C2 enter the formula

=COUNTIF($D$2:$D$6,B2). COUNTIF function is used for counting how many times B2 appears in range $D$2:$D$6. If B2 value appears in the selected range, COUNTIF returns the times B2 appears, if B2 doesn’t appear, COUNTIF returns 0.

Exclude Values from One Column 10

Step 2: Drag down the fill handle till reaching the last cell in column C. Verify that C2:C11 are filled with returned value 1 or 0.

Exclude Values from One Column 11

For values in column B, if 1 is displayed in its adjacent cell of column C, this value should be excluded.

Now you can follow step#4-#6 in method1 to exclude them.

Related Functions


  • Excel VLOOKUP function
    The Excel VLOOKUP function lookup a value in the first column of the table and return the value in the same row based on index_num position.The syntax of the VLOOKUP function is as below:= VLOOKUP (lookup_value, table_array, column_index_num,[range_lookup])….
  • Excel COUNTIF function
    The Excel COUNTIF function will count the number of cells in a range that meet a given criteria. This function can be used to count the different kinds of cells with number, date, text values, blank, non-blanks, or containing specific characters.etc.= COUNTIF (range, criteria)…

 

 

 

 

 

 

You might also like:

Sidebar