## Count matching cell values in two columns

*Article 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 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 […]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 […]### One Response to “Count matching cell values in two columns”

### Leave a Reply

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

<code>your formula</code>

Remember to convert less than and larger than signs to html character entities before you post your comment.

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

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

VBA code

[/vb]

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

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

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?