Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Spreadsheet, Count IF contains a string

I have a column like this:

What devices will you be using?

iPad
Kindle & iPad
No Tablet
iPad
iPad & Windows

How do I count the amount of people that said iPad?

This formula does work for exact matches but not if it contains an additional value:

=(COUNTIF(A2:A51,"=iPad")/COUNTA(A2:A51))*1

Any Suggestions?

like image 734
Cody Avatar asked Jun 17 '13 16:06

Cody


People also ask

How do I count a cell contains specific text in Google Sheets?

=COUNTIF(A2:A13,"*mark*") This means that where this formula checks for the given condition, there could any number of characters/words before and after the criteria. In simple terms, if the word Mark (or whatever your criterion is) is present in the cell, this formula would count the cell.

How do you count if a cell contains a string?

Select a blank cell you will place the counting result at, type the formula =COUNTIF(A1:A16,"*Anne*") (A1:A16 is the range you will count cells, and Anne is the certain partial string) into it, and press the Enter key. And then it counts out the total number of cells containing the partial string.

How do you count occurrences of a string in Google Sheets?

You can use the =UNIQUE() and =COUNTIF() functions to count the number of occurrences of different values in a column in Google Sheets.

Does Countif work with strings?

Microsoft Excel has a special function to conditionally count cells, the COUNTIF function. All you have to do is to supply the target text string in the criteria argument. Note. The Excel COUNTIF function is case-insensitive, meaning it does not differentiate letter case.


2 Answers

It will likely have been solved by now, but I ran accross this and figured to give my input

=COUNTIF(a2:a51;"*iPad*")

The important thing is that separating parameters in google docs is using a ; and not a ,

like image 50
Perry Avatar answered Oct 25 '22 19:10

Perry


In case someone is still looking for the answer, this worked for me:

=COUNTIF(A2:A51, "*" & B1 & "*")

B1 containing the iPad string.

like image 79
user2983604 Avatar answered Oct 25 '22 20:10

user2983604