## Count matching cell values in two columns

*Article last updated on January 11, 2018*

**Question:** How do I count common cell values in two columns?

**Answer:**

### Array formula in G12:

### Array formula in G25:

### Array formula in G38:

**Named ranges**

List1 (B3:B9)

List2 (B7:D9)

What is named ranges?

### How to implement array formula to your workbook

Change the named ranges.

### Download excel file for this tutorial.

count matching cell values in two columns in excel.xls

(Excel 97-2003 Workbook *.xls)

### Functions in this article:

**COUNTIF(**range,criteria**)**

Counts the number of cells within a range that meet the given condition

**IF(**logical_test;[value_if:true];[value_if_false]**)
**Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

**SUM(**number1,[number2],**)
**Adds all the numbers in a range of cells

**FREQUENCY**(data_array, bins_array)*
*Calculates how often values occur within a range of values and then returns a vertical array of numbers having one more element than Bins_array

*.*

Count unique distinct values that meet multiple criteria

This post demonstrates how to build an array formula that counts unique distinct values based on criteria. What's on this […]

Counting conditionally formatted cells (vba)

UPDATE: It is not possible to count conditionally formatted cells using vba as far as I know, I recommend you […]

This article describes how to count unique distinct values. What are unique distinct values? They are all values but duplicates are […]

Count how many times a string exists in a cell range (case insensitive)

Question: How do I count how many times a word exists in a range of cells? It does not have […]

This user defined function creates an unique list of words and their frequency in selected range. User defined function: =FreqWords(cell_range, […]

Count unique distinct values that meet multiple criteria

This post demonstrates how to build an array formula that counts unique distinct values based on criteria. What's on this […]

Count unique distinct values within same week, month or year

Introduction What are unique distinct values? Unique distinct values are all values but duplicates are merged into one value. Count […]

Count unique distinct text values in a range

Array formula in D14: =SUM(IF(FREQUENCY(COUNTIF(tbl, "<"&IF(ISTEXT(tbl), tbl, "")), COUNTIF(tbl, "<"&IF(ISTEXT(tbl), tbl, "")))>0, 1, 0)) + CTRL + SHIFT + ENTER […]

Find the longest/shortest consecutive sequence of a value

The array formula in cell D3 returns the the length of longest consecutive sequence of a value in column A. Cell […]

Table of Contents Count all overlapping days in any number of date ranges Count overlapping days in a date range […]

### One Response to “Count matching cell values in two columns”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Use the img tag, like this: <img src="Insert pic link here">

**Contact Oscar**

You can contact me through this contact form

Thanks Oscar for this great formula. I have one problem though....I am trying to count the matching cell values in two columns and I used your first formula in G12. It works well, but depends on the which is list 1 or list two.

Say I have a row with gene names from Individual one (list 1) A1:B1(206,206). THen I have in row 2 the gene names from individual 2(list 2) A2:B2 (206,209). I wish to determine how many gene names are shared in common. Clearly the answer for this simple example here is 1. But depending on which list, or row in this case that you make list 2 or list one, you get either 1 or 2. If you make A2:B2 (206,209)list 1 you get 2 gene names that match.

Is there a formula that that doesnt depend on which list you are matching to?