## Count matching cell values in two columns in excel

**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 number of times a string exist in multiple cells using excel formula

Question: How do I find the number of occurances a word exists in a range of cells? It does not […]Count records between two dates with multiple parameters in excel

Sam asks in this post: Count records between two dates in excel Any chance this would work with multiple parameters. […]Count occurences of a specific text string in a column in excel

Question: How do I count the number of times a text string exists in a column? Answer: Array formula in […]### One Response to “Count matching cell values in two columns in excel”

### Leave a Reply

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

<code>your formula</code>

**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?