Google spreadsheet search list from bottom to up - google-sheets

I have the following matrix:
A B
1 B111 YES
2 B112 YES
3 B113 NO
4 B111 YES
I need a formula that searches for the last input of an element in A to show its correspondent of B in another cell.
Something like: search in A B111; SHOW B= YES

Try this in row 1 (any column apart from A or B):
=index(B:B,max(if(A:A<>"",row(A:A))))

Related

Dynamically reference a sheet name in a SUM formula

I have 28 different tabs representing weekly data. They are titled W1, W2, W3 .... all the way up to W28. They are identically laid out just different data.
On a separate tab I am trying to SUM some fields from each week.
That tab will look like so
Week - Wins
1 - 4
2 - 2
3 - 3
the static formula for the first row in the win column would be:
=SUM('W1'!AW2:AW7)
But I want to make it dynamically reference the sheet name. Let's assume Week # is column C and they start in row 4. This formula seems to return the proper sheet names:
="'W"&INDIRECT("C4:C31")&"'" (Gives me 'W1', 'W2', 'W3', etc in the corresponding wins column)
But I am unable to combine it with the above SUM formula to dynamically reference the sheet name.
=SUM("'W"&INDIRECT("C4:C31")&"'"&!AW2:AW7) -> Formula Parse Error
=SUM('W&INDIRECT("C4:C31")&'!AW2:AW7) -> Unresolved Sheet Name W&INDIRECT("C4:C31")&
I've tried other variations with no luck so far.
Any suggestions?
Thanks
example:
formula:
=SUMPRODUCT(REDUCE(, SEQUENCE(28), LAMBDA(a, b, {a; IFERROR(IMPORTRANGE(
"1ToGglifTsqotZ0jDthW2rojWbIXRYPvKUHpdJVzpZ_I", "W"&b&"!B2:B5"))})))
or:
=SUM(REDUCE(, SEQUENCE(28), LAMBDA(a, b,
{a; IFERROR(INDIRECT("W"&b&"!B2:B5"))})))
update:
=QUERY(REDUCE(, SEQUENCE(28), LAMBDA(a, b,
{a; SUM(IFERROR(INDIRECT("W"&b&"!B2:B5")))})), "offset 1", )

sum rows if another column has the word 'yes' in it using google sheets

:)
I'm trying to learn google sheets and there is something that I want to do and I can't figure out how.
A B
5 yes
3 no
yes
2 yes
yes
5 no
no
3 no
yes
yes
3 yes
no
no
5 no
=SUM(A1:A14)
as you can see in this example i have two columns
A - a number
B - yes or no
at the bottom I added =SUM(A1:A14) and it sums column A properly.
what If i want to sum column A only on rows that has yes in column B?
how can I do that ?
thanks!
=SUMIF(B:B,"yes",A:A)
And if you expand into more columns, than =SUMIFS() will allow multiple conditions.
Documentation
try:
=SUM(QUERY(A:B; "select A where B='yes'"; 0))
or:
=SUM(FILTER(A:A; B:B="yes"))
or:
=INDEX(SUM(IF(B:B="yes"; A:A; )))

Google Sheet - how to check if value is in diffrent column?

I have 2 columns A and B in google sheet and I would like to make 3rd column C in which I will have only values that are in column B and are NOT in column A.
Do a countifs of A given value of B
Anything that comes back as 0 is good to go into C.
Filter or sort your range
just copy paste
value into C.

Google Spreadsheets, match/lookup in ALL rows, except the current one

Google Spreadsheets, match/lookup in ALL rows, except the current one
I have never come across a method that looks in all rows, except the current.
Say you have a match or vlookup and it looks in ALL the rows except the current one the formula is in.
We use a formula like below that verifies if a certain value already exists (using a MAX), but if it finds itself then the match or vlookup is always 1 (or in error)
A B
1 Formula: Does value 1 from cell A1 exist in column A?
2 Formula: Does value 1 from cell A2 exist in column A?
3 Formula: Does value 1 from cell A3 exist in column A?
4 Formula: Does value 1 from cell A4 exist in column A? Check all except row 4
Something like this
Formula in cell C4: match(A4;A$1:A3&A5:A)
Or Formula in cell C4: match(A4;A:A&[^A4])
You can use this formula from the second row of data onward (B2=):
=IFERROR(MATCH(A2,A$1:A1,0),MATCH(A2,A3:A,0)+ROWS(A$1:A1)+1)
If there is no match above the current cell it will search for a match below, and will return the correct index in the full column range by adding ROWS(A$1:A1)+1 to the below match result.
Copy this formula downward from B2 to B3 and so on.
If you are trying to check whether the value appears in the column except for the current row just use COUNTIF()
Put this formula in B2
=ARRAYFORMULA(IF($A$2:$A="",,IF(COUNTIF($A2:$A,"="&$A2:A)>1,True,False)))
Otherwise please specify what kind of output you want

vlookup return array (formula only, no code please)

I have a table like so:
A B C D
1 3 2 1
2 3 2 1
3 0 2 2
I want to vlookup the first column so that it returns the 3 columns after.
For example if I look up 2, i want the return to be 3 2 1.
i need it in one formula because it will go into a sumproduct expression.
Does not have to be a vlookup. I just need something that will return me an array though some type of indexing or lookup.
One of the ways to achieve this is query. So for the data given by you (A, B, C are column), you can use the following formula to get all three columns for the lookup value 2
=QUERY($A$1:$D$3,"select B,C,D where A = 2")
Then you can apply any aggregate function on top of this too. For eg:
=sum(QUERY($A$1:$D$3,"select B,C,D where A = 1"))
Check this link

Resources