## Count multiple text strings in a cell range

The array formula below counts how many times multiple text strings exist in a cell range. It is easy to add more text strings, adjust cell range D1:E1 horizontally.

Text strings "Car" and "bike" exist 5 times in cell range A2:A5.

### Case sensitive counting

**Array formula in cell D2:**

or use this slightly larger regular **formula**:

### Case insensitive counting

**Array formula in cell D2:**

or use this slightly larger regular **formula**:

### How to enter an array formula

- Select cell D2
- Click in formula bar

- Paste above array formula
- Press and hold CTRL + SHIFT
- Press Enter

The formula bar displays curly brackets:

**{**=SUM((LEN(A2:A5)-LEN(SUBSTITUTE(A2:A5,D1:E1,"")))/LEN(D1:E1))

**}**

### Explaining array formula in cell D2

**Step 1 - Count characters in each cell**

Len(A2:A5)

becomes

Len({"Car train"; "airplane bike"; "boat Car"; "rocket Car bus Car"})

and returns {9; 13; 8; 18}

**Step 2 - Replace existing text with new text string**

SUBSTITUTE(A2:A5,D1:E1,"")

becomes

SUBSTITUTE({"Car train"; "airplane bike"; "boat Car"; "rocket Car bus Car"},{"Car", "bike"},"")

and returns {" train", "Car train"; "airplane bike", "airplane "; "boat ", "boat Car"; "rocket bus ", "rocket Car bus Car"}

**Step 3 - Count characters in each value**

LEN(SUBSTITUTE(A2:A5, D1:E1, ""))

becomes

LEN({" train", "Car train"; "airplane bike", "airplane "; "boat ", "boat Car"; "rocket bus ", "rocket Car bus Car"})

and returns {6,9;13,9;5,8;12,18}

**Step 4 - Subtract**

LEN(A2:A5)-LEN(SUBSTITUTE(A2:A5,D1:E1,""))

becomes

{9; 13; 8; 18} - {6,9;13,9;5,8;12,18}

an returns

{3,0;0,4;3,0;6,0}

**Step 5 - Divide with length of each search string**

(LEN(A2:A5)-LEN(SUBSTITUTE(A2:A5,D1:E1,"")))/LEN(D1:E1)

becomes

{3,0;0,4;3,0;6,0}/LEN(D1:E1)

becomes

{3,0;0,4;3,0;6,0}/{3,4}

and returns {1,0;0,1;1,0;2,0}

**Step 6 - Sum all values**

SUM((LEN(A2:A5)-LEN(SUBSTITUTE(A2:A5,D1:E1,"")))/LEN(D1:E1))

becomes

SUM({1,0;0,1;1,0;2,0})

and returns 5 in cell D2

### Download excel *.xlsx file

### Category: Count values

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. Tip! I highly […]Comments(93) Filed in category: Count unique distinct values, Count values, Excel

Count unique distinct values in a column

Question: I have a list of values (A1:A6), how do I count unique distinct values? Answer: First, let me explain […]Comments(26) Filed in category: Count unique distinct values, Count values, Excel

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 […]Comments(26) Filed in category: Conditional formatting, Count values, Excel

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 […]Comments(19) Filed in category: Count text values, Count values, Excel

Excel: List intervals between two values

jeyner asks: I need to count in a list the interval between the same value. Example list, 1-2-3-1-4-5-1-6-7-8-9-7-8-1 So the […]Comments(16) Filed in category: Count values, Excel, Range

Comments(16) Filed in category: Count values, Excel, Frequency

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. […]Comments(14) Filed in category: Count values, Dates, Excel

Count unique distinct values in two columns in excel

Question: I have values in two not adjacent columns. I want to know how many unique distinct values there are […]Comments(14) Filed in category: Count unique distinct values, Count values, Excel

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 […]Comments(9) Filed in category: Count text values, Count values, Excel

Count text that occurs multiple times in excel cell

Question: How do I count how many times a text string occurs in a cell in excel? Answer: Formula in […]Comments(9) Filed in category: Count text values, Excel