Function Problems

How to Check if Two Values Are in the Same Column in Excel

Khadija KhanKhadija Khan Nov 10, 2026 870 views

Question details

The user needs a formula to verify if two specific reference values (e.g., in cells F3 and F4) simultaneously exist within the identical column of a designated data range (e.g., the 'Dropdown list' worksheet).

How to Check if Two Values Are in the Same Column in Excel
Product
Excel
Device & OS
not provided
Scenario
Validating data or cross-referencing to ensure two items share the same category or column classification within a reference table.
Observed behavior
A logical test is needed that returns 'yes' if both values are located in the same column across a multiple-column range, and 'no' if they do not.
Before you start

Verify that your lookup values in F3 and F4 do not contain hidden spaces, and ensure your reference range in the 'Dropdown list' sheet is accurately defined without merged cells blocking the columns.

Solution 1Recommended

Use COUNTIF with Logical Operators (Recommended)

Use a combination of IF, OR, AND, and COUNTIF to evaluate each target column individually. This approach is highly structured and easy to read.

This formula checks each column (e.g., N through R) independently. If both F3 and F4 are found in column N, the AND statement returns TRUE. The OR statement wraps all the column checks, returning TRUE if any single column contains both values.

1
Select the destination cell

Click on the cell where you want the 'yes' or 'no' result to be displayed.

2
Input the nested formula

Click the formula bar and enter: =IF(OR(AND(COUNTIF('Dropdown list'!N:N,F3)>0,COUNTIF('Dropdown list'!N:N,F4)>0),AND(COUNTIF('Dropdown list'!O:O,F3)>0,COUNTIF('Dropdown list'!O:O,F4)>0),AND(COUNTIF('Dropdown list'!P:P,F3)>0,COUNTIF('Dropdown list'!P:P,F4)>0),AND(COUNTIF('Dropdown list'!Q:Q,F3)>0,COUNTIF('Dropdown list'!Q:Q,F4)>0),AND(COUNTIF('Dropdown list'!R:R,F3)>0,COUNTIF('Dropdown list'!R:R,F4)>0)),"yes","no")

3
Execute the formula

Press the Enter key. The cell will display 'yes' if both values share a column, or 'no' otherwise.

Use COUNTIF with Logical Operators (Recommended)
Simplified Syntax: You can optionally drop the '>0' from the COUNTIF function, as Excel naturally evaluates any positive count as TRUE. E.g., AND(COUNTIF(N:N,F3), COUNTIF(N:N,F4)).
Advanced Spreadsheet Editor

Effortlessly Manage Complex Formulas with WPS Spreadsheet

WPS Spreadsheet provides powerful support for advanced data analysis and nested logic functions like COUNTIF, IF, and MMULT. Cross-reference datasets, analyze extensive lists, and track specific values easily with its rich feature set.

  1. 1. Download and install WPS Office: Visit the official WPS website, download the free suite, and install it on your device.
  2. 2. Open your workbook: Launch WPS Spreadsheet and open the .xlsx file containing your Dropdown list data.
  3. 3. Use the Formula tools: Go to the 'Formulas' tab on the top ribbon and use 'Insert Function' to easily build your COUNTIF logic.
  4. 4. Save your work seamlessly: Save your file; WPS natively uses the .xlsx format, ensuring perfect compatibility if shared with Microsoft Excel users.
100% compatible with Microsoft Excel formulas and .xlsx filesIntuitive formula bar with instant syntax highlighting for complex nested IFsLightweight program that runs fast even when evaluating arrays across thousands of columnsFree built-in data validation and duplicate highlighting tools
microsoft office alternative - wps office

Frequently Asked Questions

Can I check if values are in the same column across an entire sheet instead of specific columns?

Yes, but using COUNTIF for thousands of columns via nested IFs is not practical. For dynamic arrays, you can use the BYCOL function combined with LAMBDA (if your spreadsheet version supports it) to iterate over all columns in an array efficiently.

How do I ignore blank cells when checking values?

You can wrap your main formula inside an initial IF statement that checks for blanks. For example, use =IF(OR(ISBLANK(F3), ISBLANK(F4)), "Missing input", [Your COUNTIF formula here]) to prevent the formula from executing when the lookup cells are empty.

Will this COUNTIF formula differentiate between upper and lower case letters?

No. The COUNTIF function is not case-sensitive. To strictly match cases, you must replace COUNTIF with an array formula utilizing the EXACT function paired with SUMPRODUCT.