Google Sheets: Index Match return multiple cells - google-sheets

Currently, I have an Index Match function that returns a single cell. I would like to return a specified number of cells in a row as shown in the attached image beside "Desired Return".
I would like to do this without implementing multiple index match functions such as:
={index(A1:E5,(match(G1,A1:A5,0)),2), index(A1:E5,(match(G1,A1:A5,0)),3), index(A1:E5,(match(G1,A1:A5,0)),4)}
and would like to implement a range of cells if possible as depicted below.
=index(A1:E5,(match(G1,A1:A5,0)),(2:4))

To limit the number of return cols, specify the appropriate range in INDEX function's first argument:
=index(B1:D6,(match(H1,A1:A6,0)),0)

use:
=INDEX(IFNA(VLOOKUP(G1, A1:E, {2,3,4}, )))

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)

Google sheets - return the column number of a cell containing specific text

In Google Sheets, using formulae, is there a way I can return the column number of a cell that equals a specific string?
I often use the VLOOKUP formula, but find that I update and add columns in the target sheet over time. The result is that any VLOOKUP pointing at that sheet will return incorrect results because the index of the value to be returned is no longer correct.
So I'm looking for a formula I can use to return the index number in a VLOOKUP formula, which will always find the column index based on the title text of that column, e.g. "Email".
The formula would need to return the index of the cell that equals, not just contains, the search text, ie return the index of "Email" column, not the "Manager Email" column. The column titles will always be unique.
I found this question, but this returns the the whole cell reference, not just the index - I'm hoping there's a simpler solution to return just the column index by searching a single row (the first row) of a sheet for a cell containing the search text.
use:
=MATCH("Email"; 1:1; 0)
match string in row 1 if exact match
also note that if you use this in Sheet2 you will need to use Sheet1!1:1
Try MATCH() function within INDEX() like.
=INDEX(D3:G5,2,MATCH("Email",D2:G2,0))

Get last row index for a specific number in Google Sheets

I have a column consisting of single numbers and blank spaces. The numbers are not unique, but can occur in multiple cells. I want to find the row index for the last number 9 (i.e., in the photo above it is in row 12). What formula can I use for this purpose? I cant get it to work with MATCH or INDEX.
Use LOOKUP which lets you search on a column a specific key (in your case C1, to return the last value 1/(A:A=C1) is used) and returns a specific range of matches (in your case to return the row index the formula takes use of ROW):
=ArrayFormula(LOOKUP(1,1/(A:A=C1),ROW(A:A)))
Try this:
=INDEX(FILTER(ROW(A1:A),A1:A=9),COUNTIF(A1:A,9))
You could try:
=INDEX(MAX(ROW(A:A)*(A:A=9)),)

In Google Sheets, how can I find text within a range of cells?

I have a range of cells in one column, some contain text and some are blank cells. I want to search the range for the first occurrence of a word. I know that it's possible to combine Index and Match functions to find exact text within a range of cells. But I need to search for partial matches. I've tried mixing using the Search function, but it doesn't seem to accept a range. How can I search a range for the first partial text match? I only want to use formulas, not script.
The search function can be applied to a range using arrayformula wrapper:
=arrayformula(search("str", C2:F9))
This returns a bunch of #value! errors where no match is found, or the position of substring when it's found. A more readable output is produced with
=arrayformula(if(iserror(search("str", C2:F9)), , C2:F9))
This leaves non-matches blank, and returns the actual cell content where there is a match. Or you could put row(C2:F9) at the end to get the row numbers, etc.
We can simply use vlookup or match formula to find a string from a specific range
Vlookup example:
=VLOOKUP(B2, $B$2:$B, 1, FALSE)
Match example:
=MATCH("Sunday",A2:A9,0)
=MATCH(DATE(2012,1,1),A2:F2)

Lookup and Transpose functions to return multiple values in a cell

I want to use a type of lookup function that will return a range of cells instead of one cell. Then transpose that data.
Typical Vlookup function
VLOOKUP(Value_Lookup Range_Column_False)
I would like that column part to be a range in a row not a specific cell. For example:
If the value exists with the defined range, send the values of the entire row the initial value is in. Then transpose the range in a selected cell.
Is there a way to do this? I am only familiar with the vlookup function, would Index Match work?
Here is a link to an example spreadsheet:
Spreadsheet example
Please try:
=transpose(query(A1:EZ4,"select * where A ='Jimmy Medina' "))
Re supplementary, please try:
=transpose(query(A1:EZ4,"select * where A ='"&'Name Selection'!$A1&"' "))

Resources