Google sheets - linking value from another sheet using LOOKUP - google-sheets

Expected result (formula cells being bold):
SHEET 1
SHEET 2
Key
Expected value
Key
Misc data
Expected value
12
C
10
asd
A
14
E
11
asd
B
10
A
12
asd
C
13
asd
D
14
asd
E
The formula I'm trying to use is
=LOOKUP(A2,'Sheet2'!$A$2:$A,'Sheet2'!$C$2:$C)
When I use this on a single sheet (tab) then it works as intended. However as soon as I'm trying to get data from another sheet, it fails with:
Error
Did not find value 'KEY' in LOOKUP evaluation.

The issue was with the key columns holding values with different data types (number vs plain text). After setting both to same data type, the formula started working.

Related

A formula that returns data from a range of two or more columns in one column

result
1
a
1
2
b
2
3
c
3
4
d
4
5
e
5
6
6
7
7
a
b
c
d
e
I want to list all the data in the range A:B as a return value in column C where the formula is written. Empty cells should be ignored.
I've tried getting a specific range of data with the indierct or indexof functions, but I have no idea how to concatenate them into one column in order if the target is more than one column!
You can try:
=LAMBDA(z,FILTER(z,z<>""))(FLATTEN(A:A,B:B))
Incase the new functions have rolled out for you, try:
=TOCOL(A:B,1,1)

Google Sheets - QUERY function with "count" aggregate and mixed data types [duplicate]

This question already has answers here:
Query is ignoring string (non numeric) value
(2 answers)
Closed 5 months ago.
I'm trying to get the count of non-empty cells in a column of mixed numbers and text in a Google Sheets document using the QUERY function, but I'm getting some results I don't understand from the count aggregate function inside the query.
I've reduced my issue to this example to demonstrate the problem (or at least show where my misunderstanding is):
.
A
B
C
D
E
F
1
10
10
10
10
10
aa
2
20
20
20
20
bb
bb
3
30
30
30
cc
cc
cc
4
40
40
dd
dd
dd
dd
5
50
ee
ee
ee
ee
ee
6
7
select count(A)
select count(B)
select count(C)
select count(D)
select count(E)
select count(F)
8
=query(A1:A5,A7)
=query(B1:B5,B7)
=query(C1:C5,C7)
=query(D1:D5,D7)
=query(E1:E5,E7)
=query(F1:F5,F7)
9
5
4
3
5
5
5
This gives me the expected value in cells A9, D9, E9 and F9, but I've got a couple of questions:
what is going on in columns B and C to cause them to give counts of 4 and 3 respectively?
how do I modify my function / query to count the number of non-empty cells in the query range regardless of data types?
I know there are other functions like COUNTA that could solve this simple case, but my actual scenario is more complicated and is part of a larger QUERY function, and it's highlighted to me that the behaviour of query("... count() ...") isn't what I expected, so I'm trying to understand that specifically.
Try below formula-
=QUERY(INDEX(TEXT(B1:B5,"#")),"select count(Col1)")
QUERY() function is auto detecting these columns as numbers so it is excluding text strings.

Search with query formula where cells are not nothing

I have range of cells and want to search with query formula where cells are not nothing.
A B C D
1 a 11 44 qw
2 b 12 r
3 c 13 44 444
4 NOT
5 f 15 55 88
6 NOT
7 h 17 gh ee
Cells in C maybe any number, maybe any word, maybe any nothing.
I want to select everything A where C has nothing.
Result must be:
a
b
c
f
h
When try all the querys formula:
=QUERY(A1:D7,"select A where not C<>'' ")
=QUERY(A1:D7,"select A where not C!='' ")
=QUERY(A1:D7,"select A where not C is null")
=QUERY(A1:D7,"select A where C !='' or not C is null")
Nothing give correct result. Looked everywhere.
What can I do?
Google QUERY function does not work here as "expected" because of mixed data types in column C. If we apply the formula =QUERY(A1:C7;"select A where C is not null";-1)
it will return only "a, c and f". The image below shows this result in column G, where G1 contains the above formula.
We should check data types more carefully, but it is difficult to do inside QUERY function. So I suggest to add one more column (E in our case) and fill it with "=TYPE(C1)" and similar functions. Having data types column, we can modify QUERY expression to take them into account. Final result is shown in column H.
Please check this approach again, if you are going to use other data types in column C.
=QUERY(A1:D7, "select A where C is not null")
...is what you need

spreadsheet graph on list of labelled data

I have a list of typed data
type date value
A 1/1/2018 42
B 1/1/2018 12
C 2/2/2018 32
A 3/3/2018 48
C 3/3/2018 21
A 4/4/2018 12
Is it possible to create a graph showing the evolution of value of each type (A, B, and C => 3 curves) with respect to time (column date).
If possible, I would like to keep that table format.

Display a range of filtered values as a comma-delimited list in one cell on a Google sheet?

Two sheets, one called Core Data, one called Schedule. The Schedule sheet needs to take information about deadlines from Core Data and display it concatenated in deadline-order. (Simple example with numbers and letters instead of dates and tasks given below.)
Here's what I have so far in 'Schedule' (cell B2 specifically in this case):
=JOIN(", ", FILTER('Core Data'!A2:A, 'Core Data'!B2:B=A2))
It's saying no matches are found so I assume this is a problem with the filter component of the formula. However, I've checked the help pages and can't see a problem with the condition I've created.
The formula should:
Get all the values in the given range (cells A2 downward on a 'Core Data' sheet),
Filter them so that only those with certain values are selected. (The information from 'Core Data' should only be selected if the date in the same row on column B matches the date in the cell in the A column on the Schedule sheet.)
Join all these values together and list them as a comma-delimited list.
Example (without dates, for ease):
Core Data sheet:
A | B
-----
a | 5
b | 7
c | 5
d | 3
Schedule sheet (or what it should look like):
A | B
---------
3 | d
5 | a, c
7 | b
Any idea what is going wrong with my formula or if there is an easier way to solve this problem?
The error message I was getting in the cell is:
Error: No matches are found in FILTER evaluation.
It turns out that the cell I was trying this formula on simply had no matches from the filter (no dates corresponded) but instead of returning empty it threw an error. This sounds simple but it's an annoying quirk for me that the cell didn't end up empty which made me assume the formula was at fault.
While the example in the question works you can quickly break it by adding an extra row to the 'Schedule' table with "8" as the value in the A column and the formula in B:
A | B
---------
3 | d
5 | a, c
7 | b
8 | N/A
The "8" throws an error since it isn't found in the 'Core Data'.
Conversely, on my original spreadsheet, When I tried the formula in a cell which did correspond to a noted deadline, it worked.
I found the solution here is to add an IFERROR function to the formula to deal with this.
So a formula that works for this is:
=JOIN(", ", IFERROR(FILTER('Core Data'!A:A, 'Core Data'!B:B=A5)))
One does not use the second IFERROR argument as advised in Google's own helpsheet. I tried putting in an empty array at first ({}) but this threw a different error. It seems if you miss the argument out, the JOIN knows it has nothing to work with and the cell ends up with a nice blank value.

Resources