Google Spreadsheet, Count IF contains a string - google-sheets

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?

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 ,

In case someone is still looking for the answer, this worked for me:
=COUNTIF(A2:A51, "*" & B1 & "*")
B1 containing the iPad string.

You should use
=COUNTIF(A2:A51, "*iPad*")/COUNTA(A2:A51)
Additionally, if you wanted to count more than one element, like iPads OR Kindles, you would use
=SUM(COUNTIF(A2:A51, {"*iPad*", "*kindle*"}))/COUNTA(A2:A51)
in the numerator.

Try using wildcards directly in the COUNTIF function :
=(COUNTIF(A2:A51,"=*iPad*")/COUNTA(A2:A51))*1

Wildcards worked for me when the string I was searching for could be entered manually. However, I wanted to store this string in another cell and refer to it. I couldn't figure out how to do this with wildcards so I ended up doing the following:
A1 is the cell containing my search string.
B and C are the columns within which I want to count the number of instances of A1, including within strings:
=COUNTIF(ARRAYFORMULA(ISNUMBER(SEARCH(A1, B:C))), TRUE)

I had similar problem however the various count solutions still wouldn't work even with wildcards of "*"& etc..... My problem was caused by &nbsb (hidden spaces) which is hidden in the background when copying eg data from a webpage. This prevents the find from working properly. Use:
=TRIM(SUBSTITUTE(A2, CHAR(160), " "))
or
=TRIM(SUBSTITUTE(A2,CHAR(160),CHAR(32)))
or similar to get rid of them.

Try just =COUNTIF(A2:A51,"iPad")

Related

How to check multiple ranges for different values in Google Sheets

I'm trying to search 3 different ranges in a tab, and trying to display Yes if all three values (email address, name, x) are found in those ranges. Basically, trying to have the formula confirm that yes, all three of those inputs are somewhere in those ranges (order doesn't matter).
Maybe I should use query or regexmatch or something? Any help is appreciated
Tried this formula:
=IF(AND('Helper Calculations'!$I:$I=$A$1,'Helper Calculations'!$J:$J=L$1,'Helper Calculations'!$L:$L=$A2),"Yes","No")
Was expecting that if the search term in each of those cells ($A$1, L$1, $A2) is found somewhere in the corresponding ranges, then it would say Yes
You can try with this (you can change the use of asterisks by wrapping in AND:
=IF(COUNTIF('Helper Calculations'!$I:$I,$A$1)*COUNTIF('Helper Calculations'!$J:$J,L$1)*COUNTIF('Helper Calculations'!$L:$L=$A2),"YES,"NO")
try:
=INDEX(IF(('Helper Calculations'!I:I=A1)*
('Helper Calculations'!J:J=L1)*
('Helper Calculations'!L:L=A2), "Yes", "No"))
Took a bit more work than I expected, but I got this working. I needed to verify that all 3 values were correct in a single row (must all be correct on that one row, can't find the correct values on multiple rows).
In order to do that, I needed to use array formula, and then decided to use index match and concatenate for the 3 values.
Process described here: https://www.ablebits.com/office-addins-blog/google-sheets-index-match/
correct formula: =IF(ArrayFormula(INDEX('Helper Calculations'!$I:$I,MATCH(CONCATENATE($A$1,L$1,$A2),'Helper Calculations'!$I:$I&'Helper Calculations'!$J:$J&'Helper Calculations'!$L:$L, 0),))=$A$1,"Y"))

Formular for counting names in a spreadsheet which are seperated with , or /

so I want to count the names in a cell which are separated with , or / like that
I tried several thing but nothing seems to work and I always get an error, can you help me out?
I tried the following formulas:
=ArrayFormula(if(len(B457:B),len(B457:B)-len(SUBSTITUTE(B457:B,",",""))+1,))
OR even easier like:
This
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+1
It would be enough if it would just count all names separated with , ...so we'd just tell people to ad a , to separate their names and not a /..but it would be nice if both would work!
Thanks so much in advance!
Best regards
Paul
use semicolon:
=ARRAYFORMULA(IF(LEN(B457:B); LEN(B457:B)-LEN(SUBSTITUTE(B457:B; ","; ""))+1; ))
Try this in cell C457 (removing all content below):
=arrayformula(if(B457:B<>"",len(regexreplace(regexreplace(B457:B,"[\/\,]$",),"[^\/\,]+",))+1,))
My example sheet screengrab works from row 2:

google sheets : Formula works differently than usual

Hi today i got a document shared by my friends. I've just found out that this document/spreadsheet doesn't work as normally. Some formula just doesn't work here.
for example , normally if i use :
={1,2,3}
it should normally create a row with 3 columns (3 cells each contains 1,2,3 respectively).
But in this document , i got : "formula parse error"
Also found out that when i try to use some formulas , for example the filter(), the help/documentation shows something really different.Pls check my screenshot, normally it uses comma (,) separator while this document using semicolon (;). I'm confused what is wrong ? I'm suspecting that this maybe about google sheet versioning. Am i correct ? or something else ?
If yes, how can i convert this old version document into the latest one ?
Thanks.
your sheet is not US-based, therefore you need to use:
={1\2\3}
ENGLISH SHEETS NON-ENGLISH SHEETS
ROW ARRAY , \
COLUMN ARRAY ; ;
FX ARGUMENT SEPARATOR , ;
language of the spreadsheet can be found in the settings:

How to lookup and sum with Google Sheets

So I have this spreadsheet
And I want to essentially grab the value to the right of the value.
So for example, if I look for x, I want to get the values of E9, and E15. So far this is my query:
=LOOKUP(D23 , $D$5:$E$16 , $E$5:$E$16 , FALSE)
But all I'm getting is:
Error
Formula parse error
Any idea what I'm doing wrong?
EDIT:
I thought I might be making a mistake, since I forgot I'd have to SUM, but after changing the key to tax it still doesn't work
I tried both LOOKUP and VLOOKUP, same problem in each
I also tried smth I found in a tutorial, but no luck
=VLOOKUP(D23 , $D$5:$E$16 , 2 , FALSE)
TO FUTURE SEARCHERS:
To figure out which "breaker" you need (, of ;), take a close look at the formula help. It's the blue question mark next to the fx
Try using SUMIF (Documentation) instead of LOOKUP or VLOOKUP.
Like so:
=SUMIF(D5:D16;"tax";E5:E16)
Also, as you are using a Polish "Locale", you should use ; instead of ,.
Reasoning: whether you have to use , or ; depends on the "Locale" of the spreadsheet, under File –> Spreadsheet Settings. For example, a US or UK "Locale" would use the former (,) while a Hungarian or Polish "Locale" would use the latter (;)
You should use SUMIF
=sumif($D$5:$D$16;"x";$E$5:$E$16)

Spreadsheets get unique names but ignore blank cells

I would like to use spreadsheets to get all unique names from Column A in a table but in the same time I would like blank cells to be ignored. So far I've got this formula that returns all of the unique names from column A but I don't know how to go about ignoring blank cells and not repeating values that have once been added previously.
Here is how my document looks so far. As you can see everything stops after Megan because there is a blank cell.
=IFERROR(INDEX($A$2:$A$90, MATCH(0, COUNTIF($I$10:I10, $A$2:$A$90), 0)), "")
Searched long and wide but came up with nothing, if anyone has any idea how one could do that I would really appreciate it. Thanks!
=unique(A2:A) should work
=unique(filter(A2:A,A2:A<>"")) to also ignore blanks
Yet another hack
=SORT(UNIQUE(A2:A))
Technically, this does not remove the blank result. But nonetheless puts it at the end of the list. You'll also benefit from the sort if you need it. 😁
You can use query:
=unique(query(A2:A,"select A where A<>''"))
You can use this code:
=IFERROR(INDEX($A$2:$A$90, MATCH(0, INDEX(COUNTIF($I$10:I10, $A$2:$A$90)+($A$2:$A$90=""), ), 0)), "")
should work

Resources