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)…

 

 

 

 

 

 

Related Posts

VBA Macro For VLOOKUP From Another Sheet
vba macro for vlookup from another sheet1

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you how to use VBA code to vlookup data ...

VLOOKUP From Another Sheet Not Working
vlookup from another sheet not working3

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you reasons why your VLOOKUP formula is not working ...

Fix #N/A Error For VLOOKUP From Another Sheet
vlookup from anther sheet not working1

This post will show you how to fix the #N/A error why it occurs when you extract values from another sheet using VLOOKUP function in Excel 2016,2013,2010 or other Excel versions. How can you correct a #N/A error in VLOOKUP ...

Get Employee Information by VLOOKUP

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. Today, in this article, we will show you the way to apply VLOOKUP to retrieve employee information. I hope this article will help you in ...

VLOOKUP with Two Lookup Tables

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. Today we will show you the application of VLOOKUP function when there are two lookup tables. EXAMPLE Table1 and table2 record the rates of Y2020 ...

VLOOKUP with Multiple Lookup Values

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

VLOOKUP Data by Date

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

VLOOKUP – Retrieve Data from Another Workbook
VLOOKUP - Retrieve Data from Another Workbook 1

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

VLOOKUP – Retrieve Data from Another Worksheet
VLOOKUP - Retrieve Data from Another Worksheet 3

VLOOKUP is one of the key functions among all lookup & reference functions in Excel. It can scan and retrieve data from a static or dynamic table based on your lookup value. It can perform approximate match or exact match ...

Case Sensitive Lookup with SUMPRODUCT and EXACT

Today, we will show you how to use SUMPRODUCT and EXACT to perform a case sensitive exact match. In this article, we provide a simple example to calculate bonus for employees whose names are case-sensitive. If you meet similar scenarios ...

Sidebar