Find a specific cell based on a dropdown - google-sheets

I'm trying to the cell next to a name selected in a dropdown which that the total time listed. I thought it might be something like =SUMIF(E4,'Refined Data'!A:A,'Refined Data'!B:B) but that is not working.
The desired out come would be if you select Person 1 in the dropdown, it would say 0:00:54 in cell E6 since that is the cell next to person 1 in Refined Data and Person 2 in the dropdown would then cause E6 to say 2:10:31. Here is an example.

Add this formula below on cell E6 on your "Dashboard" sheet:
=vlookup(E4,'Refined Data'!A1:B100, 2)
This should work fine

=VLOOKUP(E4,'Refined Data'!A1:B100, 2, 0)
Here’s what the VLOOKUP formula looks like:
VLOOKUP(search_key, range, index, [is_sorted])
search_key – This is the value or item you’re looking for. For example, in the case of the restaurant, it would be burger or pizza.
range – this is the range to be used in the Vlookup function. The left-most column of this range would be searched for the search_key.
index – this is the column number from where you want to get the result. The first column in the range is 1, the second column is 2, and so on. Note that this value should be between 1 and the total number of columns. If not, then it would return a #VALUE! Error.
is_sorted – [TRUE by default] – in this argument, you can specify whether you’re looking for an exact match or an approximate match. You can use FALSE for exact match and TRUE for an approximate match. When you use TRUE, the list needs to be sorted in an ascending If you don’t specify a value here, it takes TRUE as default.
Dummies

Related

How can I find the name of the person ranked 1?

What I'm trying to do is find the name of the person who is ranked number 1 in the table shown below. I have tried =LOOKUP and =VLOOKUP but I get an error saying that a result can't be found, even though it's obviously there. I assume that I'm either using the wrong function or just not using it right.
I tried =VLOOKUP(1;D2:H19;1) and =LOOKUP(1;D2:H19;1) but neither seems to work.
Answer
The following formula should produce the behaviour you desire:
=INDEX(D2:D,MATCH(1,H2:H,0))
Explanation
=VLOOKUP can only be used to find values to the right of a search key. To find values to the left of a search key, use a combination of =INDEX and =MATCH.
The =MATCH function searches a specified range for a specified value and returns the relative position of the value in that range. In this case, the value to search for is 1, the range to search through is H2:H, and the 0 at the end specifies that the range is not sorted in any way.
The =INDEX function returns the contents of a cell within a range having a specified row and column offset. In this case, the range is D2:D, and the row is whichever row is returned by =MATCH. =INDEX could take a third argument if it was desired to specify a row offset as well, but that is not necessary here.
Functions used:
=INDEX
=MATCH
You sort your ascending order based on rank then return your desired data using INDEX() function. Try-
=INDEX(SORT(D2:H500,5,1),1,1)
=vlookup(1,{H2:H19, D2:D19},2)
Since vlookup only searches the 1st column of the input range, to use it, you need to flip the columns by composing a local array: {H2:H19, D2:D19}.
{} means concatenation. , in it means horizontal concatenation. With that, the rank column is now the 1st column in the input of vlookup and now vlookup works.
With our local array, the 2nd column are the names and therefore index should be 2.
Also note the use of comma to separate function inputs.
your VLOOKUP formula should look like:
=VLOOKUP(1, {H2:H19, D2:D19}, 2, 0)
also try just:
=FILTER(D:D; H:H=1)
or:
=SORTN(D:D; 1; 1; H:H; 1)
You can use query (usefull in case of ex aequo)
=query(D2:H,"select D where H=1",0)

Third Parameter in Array Formula to check for highest(max) occurence but only if the other conditions are true first

Ok, this is the updated linkI have multiple criteria to look through in my arrayformula(index(match())). The first two are simple as they reference the row the formula is calculating on. The last conditional I have is to find the highest occurrence in a given range, but ONLY if the other conditions are met...something like a filtered maxifs..any ideas?
Here is my code in column P =iferror(ArrayFormula(index($F:$F,match(1,("Fee Taken"=$C:$C)*(H12=$H:$H)(maxifs($M:$M,$H:$H,H2,$C:$C,"Fee Taken"),0))),""))
The result that I would like is to return from column F if the name matches that rows name, the transaction type is "Fee Taken" from column C, and THEN if those conditions are true I want it to find the max value from column M based on those two criterias and return the column F value for that max value row..
Ive attached some pictues to show my data.
The last part of the Match function where I have the Maxifs equaling to eachother is where I am confused; my thoughts were to see if the maxifs for the item in Column "M" can be used as a criteria..but I do not think so....I only want the highest occurence F:F if both conditions are met and it is the highest value for both those criteria in column M..
Please let me know if you need anymore info..Thanks![
Working formula will be:
=ArrayFormula(index($F:$F,match(1,--(M:M=(maxifs($M:$M,$H:$H,H2,$C:$C,"Fee Taken"))),0)))

Google Sheets - how do you use LOOKUP and SPLIT to map a list of row references to values

I am trying to setup a mapping of a list of values. One cell in a row contains a list of IDs or row numbers, and another cell in the same row contains a list of mapped values.
This is very simple with JOIN, ARRAYFORMULA and SPLIT if you are doing some basic math, for example:
A1: =1,2,3
A2: =JOIN(",",ArrayFormula(SPLIT(A1,",")+1))
A2: displays "2,3,4" (correct)
This does not seem to work robustly with LOOKUP and SPLIT (also tried LOOKUP and REGEXEXTRACT). Specifically, I can get it to work, even with variable parameters, but as soon as I change the rows the values break. Example:
A column: ids (e.g. 1,2,3,4)
C column: names (e.g. "Apple", "Banana", "Custard")
E7: =1,2,3
F7: =JOIN(",",ArrayFormula(LOOKUP(SPLIT($E7, ","), $A:$A, $C:$C)))
F7 displays "Apple,Banana,Custard" (correct)
The above is correct behaviour. However, if I drag row 1 (id 1) to a different place, the formula breaks.
F7 displays "#N/A Did not find value `1` in LOOKUP evaluation"
The behaviour is not specific to LOOKUP or SPLIT, as I have also tried it with VLOOKUP and REGEXEXTRACT (in fact, with REGEXEXTRACT it is more difficult to support variable list size).
Sample Sheet
SOLUTION
It works when using "=ROW()." The actual problem, as pointed out by AdamL, is that the is_sorted flag needs to be false (if you want to support drag & drop)
E7: =ROW(A2)&","&ROW(A3)&","&ROW(A4)
F7: =JOIN(",",ArrayFormula(VLOOKUP(SPLIT($E7, ","), $A:$C, 3, 0)))
F7 displays correct value even after dragging row 1
I think the issue is: when you drag and drop, the lookup list is no longer sorted, and LOOKUP, along with VLOOKUP without FALSE (or 0) specified for the (optional) fourth argument, requires a sorted list. So I think the solution is to use VLOOKUP, but with the fourth argument specified:
=ArrayFormula(JOIN(",",VLOOKUP(SPLIT($E5,","),$A:$D,3,0)))

VLOOKUP alternatives

I am trying to do a VLOOKUP but its just not going to cut the mustard. There is no way I can alphabetize the first column in my list.
What I am wondering is there any alternatives or combinations of functions that I could use along VLOOKUP in the case that the list can not be alphabetized?
From the link in your comment on your OP:
Range_lookup A logical value that specifies whether you want
VLOOKUP to find an exact match or an approximate match:
If TRUE or omitted, an exact or approximate match is returned. If an
exact match is not found, the next largest value that is less than
lookup_value is returned.
The values in the first column of
table_array must be placed in ascending sort order; otherwise, VLOOKUP
may not give the correct value. You can put the values in ascending
order by choosing the Sort command from the Data menu and selecting
Ascending. For more information, see Default sort orders.
If FALSE, VLOOKUP will only find an exact match. In this case, the
values in the first column of table_array do not need to be sorted. If
there are two or more values in the first column of table_array that
match the lookup_value, the first value found is used. If an exact
match is not found, the error value #N/A is returned.
It isn't terribly obvious the way that document is formatted, but the qualification that the lookup range must be sorted ascending only applies for when the 4th argument in VLOOKUP is TRUE, or a non-zero positive number, or omitted. (If the 4th argument is a non-zero negative number, the first column must be sorted descending.) In these cases, you are allowing the formula to return a non-exact match.
If you are looking for an exact match only, then you must specify FALSE (or zero) for the 4th argument, and the first column needn't be sorted at all.
If you are looking for an non-exact match on an unsorted range, then something like this should work in Google Sheets (assuming you are looking for a match of C1 in column A, and returning the corresponding entry in column B):
=INDEX(SORT(FILTER(A:B;LEN(A:A));1;1);MATCH(C1;SORT(FILTER(A:A;LEN(A:A));1;1));2)
DGET - there are a bunch of database style functions in google spreadsheets, I suspect DGET is the one you want.
Plain Text: With vlookup 1 and "1" are not the same. If you format the column as plain text it can do the lookup. This works even if your cell has a formula that produces a number.

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