Finding top 3 values along with their headers - google-sheets

I want to be able to look at two rows and retrieve the top 3 highest values(found in row 2) along with their header(found in row 1). Here is what I have:
I am using the Large formula to retrieve the values, however it only brings the value. Is there a way for me to also retrieve its header? If so how?
Thank you in advance!
UPDATE: I just attempted to use the Lookup formula doing, "=LOOKUP(A7,A2:F2,A1:F1)" however it returned Value 6 instead of value 4, same with other values.

In A6 try
=transpose(array_constrain(sort(transpose(A1:G2), 2, 0), 3, 2))
and see if that works?

Related

In Google Sheets, how can I check a list of entries for missing values and generate a new line with the missing value?

As per the image example below, I would like to scan a list of entries for a missing data points (e.g.: I expect 3 different month names per name entry in the list, but some names only received offers in 2 or 1 of these months), and for each detected missing entry, automatically generate a new line with the value of row A, the scanned for value of row B filled in, and row C with a blank value.
I've tried generating this via an IF formula, but to no avail.
Is there a way to do this via formula, or would this require a macro?
The example below shows the input on the left with the desired output on the right. Any hints are much appreciated!
Example
try:
=INDEX(TEXT(LAMBDA(n, SORT(LAMBDA(x, {SPLIT(x, "​"),
IFNA(VLOOKUP(x, {n&"​"&"1/"&MONTH(LEFT(OFFSET(n,,1), 3)&1), OFFSET(n,,2)}, 2, ))})
(LAMBDA(a, FLATTEN(UNIQUE(FILTER(a, a<>""))&"​"&
TRANSPOSE(UNIQUE(FILTER("1/"&MONTH(LEFT(OFFSET(a,,1), 3)&1),
OFFSET(a,,1)<>"")))))(n)), 1, 1, 2, 1))(A2:A), {"#", "mmm", "#"}))

Sum multiple values returned vertically from vlookup

I have the following table which I need to have all the values found from multiple ranges vertically.
I was using the following formula, but I'm only getting 1 result and not 7. After getting all those 7 values, I need to add them together in order to get a total.
So far my guess was to try the 2nd formula but obviously is not returning what I need but maybe is something around those corners.
=SUM(ARRAYFORMULA(VLOOKUP(E4,{range0,range1,range2,range3,range4,range5,range6},5,false)))
=SUM(ARRAYFORMULA(VLOOKUP(E4,{range0,range1,range2,range3,range4,range5,range6},{5,5,5,5,5,5,5},false)))
You can use FILTER instead:
Formula:
=SUM(INDEX(FILTER(B6:F, B6:B = "name1"),,5))
Use FILTER to get the rows of B6:F where "name1" is found in B6:B
Use INDEX to get only the specific column which is in our case, 5
Then SUM the column.

Adding values based on other values but SUMIF is quite right

Here is a link to my spreadsheet. Essentially what I am looking for is if the task matches then I want to also be able to give a Tech level then from there add up the values. I put a note in the sheet but basically if I give a task value and a tech level I want the corresponding value but whenever I try to do multicolumn adding in my sumif it just gives me the value from the first column.
An example of the formula I want is something like =SUMIF(Name, Name2 and Rank, Add Values).
try:
=INDEX(IFNA(VLOOKUP(K3:K&"♥"&L3:L, SPLIT(FLATTEN(
IF(B2:D="",,A2:A&"♥"&B1:D1&"×"&B2:D)), "×"), 2, 0)))
I think what you are looking for can be done by using a Index-Match function.
e.g. If you paste the following formula in an empty cell somewhere in the sheet,
=INDEX($A$1:$D$8, MATCH("Task 1",$A$1:$A$8,0),MATCH("Tech 2",$A$1:$D$1,0))
it gives you 20 corresponding to Task 1 and Tech 2.
If you paste the following in an empty cell somewhere in sheet,
=INDEX($A$1:$D$8, MATCH("Task 7",$A$1:$A$8,0),MATCH("Tech 3",$A$1:$D$1,0))
it gives you 36 corresponding to Task 7 and Tech 3.

Getting the second, third, fourth value from a table

I'm trying to calculate the 1st, 2nd and 3rd, 4th-year revenues of order from a table I have.
I'm created a formula in Google Sheets to return the first non-zero value in a table:
=ARRAY_CONSTRAIN(ARRAYFORMULA(INDEX(3:3,,SMALL(IF(J3:R3<>0,COLUMN(J3:R3),""),1))), 1, 1)
This does the job I need to but I'm not sure how to adapt the formula to get to the second or third values instead of the first.
Can anyone point me in the right direction?
You should just be able to change the first 1 to 2, 3 etc.
=ARRAY_CONSTRAIN(ARRAYFORMULA(INDEX(3:3,,SMALL(IF(J3:R3<>0,COLUMN(J3:R3),""),2))), 1, 1)
It works for me without the array formula wrapping
=INDEX(3:3,,SMALL(IF(J3:R3<>0,COLUMN(J3:R3),""),2))
BTW if you do it like this you can pull it across to get the first, second, third etc.
=INDEX(3:3,,SMALL(IF($J3:$R3<>0,COLUMN($J3:$R3),""),columns($A:A)))

Getting Corresponding Cell In Google Sheets?

I have a Google sheet for tracking my weight. I have two columns: Date and Weight. While the goal is to have the weight column sorted in descending order, that doesn't always happen in reality...
The data essentially looks like this (weights changed to far lower values, of course):
Date |Weight
04/01/10|195
04/02/10|194
04/03/10|190
04/04/10|198
etc.
Anyway, I have a cell in another spot on the sheet that shows the minimum value from the weight column using this formula
=(Min(B:B))
What I would like to do is display the corresponding date cell for whatever the minimum value from the weight column is. So, with this dataset, I want to show 190 for weight and 04/03/10 for date. Is there any way to get that corresponding cell? I looked through the function reference for Google docs, but can't get anything going. I tried using some of the functions from the Lookup category, but got nowhere. Most want a cell reference, but the min() function returns a value. I think I need to somehow get min() to give me a cell reference, but I don't know how to do that. HLOOKUP() sort of seemed like it might be appropriate, but the docs were a bit spotty, and it didn't do anything but error out the cell.
Of course, I may be barking up the wrong tree entirely.
Thoughts?
I would use the following two formula's:
MIN(B2:B)
FILTER(A2:A;B2:B=minimal value)
If there are more results, they need to be included as well.
See example file I've created: Getting Corresponding Cell In Google Docs Spreadsheet?
Not barking up the wrong tree, actually very close:
=index(A:A,match(min(B:B),B:B,0))
should meet your requirement.
Working inside out: min(B:B) (as you had) returns the lowest weight (ie 190) in ColumnB.
match then finds the position of that value relative to the start of the range in which the value is searched for. So assuming Date is in A1, that returns 4, being the fourth row in ColumnB, where 190 is. The 0 in the formula is to ensure that only the position of an exact match is returned.
Now we know we need the content of the fourth row we can go looking for the value there in ColumnA with index, returning 04/03/2010.
Not all is ideal however. It is possible that a weight of 190 was achieved on separate days. It is the nature of match that where an exact match is required and found the function stops looking for any further instances. Hence as things stand 04/03/2010 will be returned for 190 however often that is the weight for a day after 04/04/2010 - unless other steps are taken, such as to delete/remove/ignore data from 04/03/2010.
You need to change the order of the column as the search column (the weight should be the first in the search array. Then you can use the VLOOKUP formula:
=VLOOKUP(C7,A:B,2,false)
C7 holds the MIN formula that you used: =(Min(A:A)) - note the column order change
one-cell solution to get minimal value with the latest day:
={MIN(B:B), TO_DATE(VLOOKUP(MIN(B:B), SORT({B:B,A:A}, 2, 0), 2, 0))}
to get all minimal values with dates:
=QUERY(A:B, "select B,A where B matches '"&MIN(B:B)&"' order by A desc", 0)

Resources