I'm trying to do a lookup based on 2 criteria to match on another sheet and return a value from the last match that it finds.
I've been able to get this logic working with a single criteria:
=INDEX('Rank History'!B:E, MAX(filter(ROW('Rank History'!E:E), 'Rank History'!E:E=C3)),3)
and I've been able to do it with multiple criteria:
=INDEX('Rank History'!D:D, MATCH(1, (B3='Rank History'!B:B) * (C3='Rank History'!E:E), 0))
How do I tie these two approaches together?
Try this:
=INDEX('Rank History'!D:D, MATCH(2, 1 / ((B3='Rank History'!B:B) * (C3='Rank History'!E:E))))
Related
I'm working in Google Sheets and trying to create a FILTER function that returns only the results from a second table where a pair of values exists in the first table. Here's a simplified example:
SpellsInitial (Table 1)
Level
Name
1
Heal
2
Flaming Sphere
3
Fireball
SpellsHeightened (Table 2)
Level
Name
1
Heal
2
Flaming Sphere
2
Heal
3
Fireball
3
Flaming Sphere
3
Heal
And I want to filter SpellsHeightened to return only the results that are in SpellsInitial—essentially "(Level=Level)*(Name=Name)=1".
I have a FILTER function taking a level value as input to print a list of names, but I can't seem to get the ArrayFormula part to work.
=TRANSPOSE(FILTER(SpellsHeightened_Name, A30=SpellsHeightened_Level, (SpellsHeightened_Name=SpellsInitial_Name)*(A30=SpellsInitial_Level)))
I know what I actually need on the last line is "the value on a given line in SpellsHeightened_Name" because otherwise it's the whole array, but I guess I'm struggling to identify and pass in that value using only a level value as input. I tried nesting one FILTER (to get the list of names from Heightened) inside a second FILTER (to match the names up with Initial) but could get that figured out either.
Here's the actual thing in practice.
Perhaps:
=FILTER( SpellsHeightened,
ISNUMBER( MATCH( SpellsHeightened_Level&SpellsHeightened_Name,
SpellsInitial_Level&SpellsInitial_Name, 0 ) ) )
I have events coming to esper and i have this query
select * from Location match_recognize (
measures A[0] as loc1 , count(A.locationID) as idcount
pattern (A{3,})
define
A as A.lat > (prev(A.lat, 1) -100) and A.lat < (prev(A.lat, 1) +100) and A.lon > (prev(A.lon, 1) -100) and A.lon < (prev(A.lon, 1) +100)) ;
That query hits at finding a sequence of 3 close locations. I searched and found i have four continuous on my data. I want the query to hit all 4 of them. I found that queries stop when there are 3 matches because of default skip clause. I want to change that setting or find a query that hits when there are at least 3 continuous A and stop when A misses.
You could define a "B" that ends the search and use "pattern (A{3,} B)". This way the search only ends when the runtime finds a B. The define-clause for B would specified how the pattern ends. Use the "last" aggregation for getting the last-A values.
Using Neo4j.
I would like to add a integer number to values already existing in properties of several relationships that I call this way:
MATCH x=(()-[y]->(s:SOL{PRB:"Taking time"})) SET y.points=+2
But it doesn't add anything, just replace by 2 the value I want to incremente.
To achieve this use
SET y.points = y.points + 2
From your original question it looks like you were trying to use the Addition Assignment operator which exists in lots of languages (e.g. python, type/javascript, C#, etc.). However, in cypher += is a little different and is designed to do this in a way which allows you to add or update properties to or on entire nodes or relationships based on a mapping.
If you had a parameter like the below (copy this into the neo4j browser to create a param).
:param someMapping: {a:1, b:2}
The query below would create a property b on the node with value 2, and set the value of property a on that node to 1.
MATCH (n:SomeLabel) WHERE n.a = 0
SET n+= $someMapping
RETURN n
Google Spreadsheets: I am trying to match multiple variables in multiple columns
I have tried this code
=match(T7&C7&"v";T$2:T6&C$2:C6&K$2:K6)
that I expected would woork, but it does not .... any ideas how I can do this?
Try this:
=ARRAYFORMULA(match(T7&C7&"v",ARRAYFORMULA(TRANSPOSE(Split(CONCATENATE(T$2:T6&C$2:C6&K$2:K6&"|"),"|"))),0))
If this does not work, please give us an example of your data
This is the final formula
=if(D2<>""; vlookup(arrayformula(MAX(( T$1:T1 = T2 )*4 + ( C$1:C1 = C2 )*2 + ( K$1:K1 = "✓" )*1));Lookup!D:E;2);"")
First check if cell empty
Then find mathcing values above the current row, start with most
important first
Then verify/code-label the results (7 = full match, 6 = site +
link, 4 = only site)
Setup a lookup table to translate the results to values you
understand
I have a Cypher query that combines two result sets that I would like to then order as a combined result.
An example of what I am trying to do is here: http://console.neo4j.org/r/j2sotz
Which gives the error:
Cached(nf of type Collection) expected to be of type Map but it is of type Collection - maybe aggregation removed it?
Is there a way to collect multiple results into a single result that can be paged, ordered, etc?
There are many posts about combining results, but I can't find any that allow them to be treated as a map.
Thanks for any help.
You can collect into a single result like this:
Start n=node(1)match n-[r]->m
with m.name? as outf, n
match n<-[r]-m
with m.name? as inf, outf
return collect(outf) + collect(inf) as f
Unions are covered here: https://github.com/neo4j/neo4j/issues/125 (not available right now).
I haven't seen anything about specifically sorting a collection.