VLOOKUP to the left - google-sheets

I've read this article and tried it out myself with the formula
=VLOOKUP(C1;{Daten!B2:B10;Daten!A2:A10};2;false)
Note that I'm using the German version, so using ";" as delimiter is fine. This formula doesn't give me a syntax error but I get "#REF!" as error. Can somebody explain what I did wrong? By the way: If I write
=VLOOKUP(C1;{Daten!B2:B10;Daten!A2:A10};1;false)
instead it perfectly works fine and I just get the value of C1 back what is kind of pointless.

For your locale settings you have to use the backslash to create an array of columns:
{Daten!B2:B10\Daten!A2:A10}
A FYI, you could also change FALSE to 0. Just a little shorter.

Related

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)

Replacing empty string cells with specific value

as you can see I have a database in SPSS and I encountered a problem where one of the columns has empty cells. Now the problem is that the type of data in that column is string. If it was numeric/integer there are tons of videos showing how to do it but none for string cells. I want to fill the empty string cells with the word "null" or "none" but I can't find a way to do it. Help!
You can use the following syntax:
IF V13 = '' V13 = 'Null'.
EXECUTE.
This syntax translates to something like: "If V13 is blank, make V13 equal to the string value 'Null'.
Just run the below syntax:
DO REPEAT S=V13 V16.
IF S="" S="none"
END REPEAT.
EXECUTE.
Store in S all your string variables. only V13 and V16 are visible on screen, so my example is built around them. But you can put as many as you need.

Why is this IMPORTRANGE formula not working?

I keep getting an error while using the IMPORTRANGE formula:
=importrange(“1uUbz2HAzgwBwY3zMXqcLJM_Z8qVQZHNP0wzRaNHceTc”, “Sheet1!A:B”)
I changed the name of my sheets several times to make sure everything matches but see a:
Formula parse error
and I am not sure what I am doing wrong. The original sheet has several tabs as well.
Can you see where the error is?
This worked for me:
=importrange(“1uUbz2HAzgwBwY3zMXqcLJM_Z8qVQZHNP0wzRaNHceTc”; “Sheet1!A:B”)
Maybe try it with a semicolon
Add the link format
eg
=importrange("https://docs.google.com/spreadsheets/d/1uUbz2HAzgwBwY3zMXqcLJM_Z8qVQZHNP0wzRaNHceTc","Sheet1!A:B") this should fix it
One other issue that can prevent import range from working is leading or trailing space in your sheet name. Make you check the sheet tab and clean out any leading or trailing spaces or your formula won't work. :-)
I burned an hour reading this thread and recreating my formula over and over again before I finally found the issue.
You have it as Sheet1!A:B, but you are missing the single quotes to identify the sheet name.
It should be 'Sheet1'!A:B instead.
The full formula is below:
=importrange(“1uUbz2HAzgwBwY3zMXqcLJM_Z8qVQZHNP0wzRaNHceTc”, “'Sheet1'!A:B”)
Make sure the sheet you're trying to import from is saved as a google sheet. I was trying to import an .xls file into a google sheet, and it wouldn't work. I re-saved the sheet as a google sheet and it fixed the problem immediately.
Problem
This formula does not work
=importrange(“1uUbz2HAzgwBwY3zMXqLJM_Z8qVQZHNP0aNHceTc”,“Sheet1!A:B”)
Reason why
You use curly double quotes “ ” instead of straight double quotes " "
SOLUTION
Change the quotes from curly to straight
=importrange("1uUbz2HAzgwBwY3zMXqLJM_Z8qVQZHNP0aNHceTc","Sheet1!A:B")
Be careful
If you have different locale you must also change , to ;

Countif with len in Google Spreadsheet

I have a column XXX like this :
XXX
A
Aruin
Avolyn
B
Batracia
Buna
...
I would like to count a cell only if the string in the cell has a length > 1.
How to do that?
I'm trying :
COUNTIF(XXX1:XXX30, LEN(...) > 1)
But what should I write instead of ... ?
Thank you in advance.
For ranges that contain strings, I have used a formula like below, which counts any value that starts with one character (the ?) followed by 0 or more characters (the *). I haven't tested on ranges that contain numbers.
=COUNTIF(range,"=?*")
To do this in one cell, without needing to create a separate column or use arrayformula{}, you can use sumproduct.
=SUMPRODUCT(LEN(XXX1:XXX30)>1)
If you have an array of True/False values then you can use -- to force them to be converted to numeric values like this:
=SUMPRODUCT(--(LEN(XXX1:XXX30)>1))
Credit to #greg who posted this in the comments - I think it is arguably the best answer and should be displayed as such. Sumproduct is a powerful function that can often to be used to get around shortcomings in countif type formulae.
Create another list using an =ARRAYFORMULA(len(XXX1:XXX30)>1) and then do a COUNTIF based on that new list: =countif(XXY1:XXY30,true()).
A simple formula that works for my needs is =ROWS(FILTER(range,LEN(range)>X))
The Google Sheets criteria syntax seems inconsistent, because the expression that works fine with FILTER() gives an erroneous zero result with COUNTIF().
Here's a demo worksheet
Another approach is to use the QUERY function.
This way you can write a simple SQL like statement to achieve this.
For example:
=QUERY(XXX1:XXX30,"SELECT COUNT(X) WHERE X MATCHES '.{1,}'")
To explain the MATCHES criteria:
It is a regex that matches every cell that contains 1 or more characters.
The . operator matches any character.
The {1,} qualifies that you only want to match cells that have at 1 or more characters in them.
Here is a link to another SO question that describes this method.

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?
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")

Resources