I have a vlookup which gives an output Sheet2!A:B. I want to use this sheet reference as an argument in another Vlookup as:
Vlookup(something, Sheet2!A:B,something, something)
I want the second Vlookup to use that as a cell reference. How can I do this?
If the first VLOOKUP function is returning the literal string "Sheet2!A:B" then wrap it in the INDIRECT function to convert text that looks like a cell range reference into an operational cell range reference. Example:
=VLOOKUP(1, Sheet1!A:Z, 26, FALSE) ◄ returns the text string "Sheet2!A:B" (sans quotes)
=VLOOKUP(<something>, INDIRECT(VLOOKUP(1, Sheet1!A:Z, 26, FALSE)), 2, FALSE)
You can just cascade the Lookups In this example, the first look-up in cell B2 finds the name of a happy person in table C1:D5.
The second look-up uses the result of the first to find the happy person's score in C7:D11
Related
I have a question about excel function.
The question is:
I want to use VLOOKUP-like function, but VLOOKUP only search leftmost row.
Is there any function that searches non-leftmost row (you can select) and the behavior is almost same as VLOOKUP function?
If you don't understand, please see this picture.
I want to do like this in Excel.
Thank you for reading.
INDEX MATCH Combo
You can use combination of 2 functions:
INDEX function
The INDEX function returns a value or the reference to a value from within a table or range.
MATCH function
The MATCH function searches for a specified item in a range of cells, and then returns the relative position of that item in the range. For example, if the range A1:A3 contains the values 5, 25, and 38, then the formula =MATCH(25,A1:A3,0) returns the number 2, because 25 is the second item in the range.
Example
=INDEX(Name_col, MATCH(Rank_input, Rank_col, 0)).
Equivalent, using your concrete data, assuming you have "Alex" in A3:
=INDEX($A$3:$A$7, MATCH(A10, $C$3:$C$7, 0))
I have the following as target:
In another workbook, I have as a data source this table:
So, using VLOOKUP formula I'm retrieving the values that I want for the cell just with formulas like that:
=CONSULTAV("user1";login.xlsx!Tabla1[#Datos];2;FALSO
CONSULTAV is the spanish formula for VLOOKUP, so I guess in english (just for better understanding as this is a english website) should be something like:
=VLOOKUP("user1";login.xlsx!Table1[#Data];2;FALSE
I want to type in the cell a simpler formula , something like:
=FindValue("user1")
So that formula calls the VLOOKUP formula and just uses the value as first argument for the VLOOKUP formula for searching the value.
Assuming the following data layout,
Select B3 and then create a defined name with the following parameters,
That formula is,
=VLOOKUP("password"&RIGHT(Sheet4!B2, 1), Table1[#All], 2, FALSE)
Now use =FindPassword in B3.
This method will always find the password associated with the user in the cell directly above it.
I was wondering why the formula I did won't go to the next column over. I did place the $ sign to stay in the same row, but not on the column, thinking it will go to the next column over. Is there any suggestions as to why this is doing this?
The following is the formula I inputted into the spreadsheet:
=(INDIRECT("BHR8732A2!P$16"))*$S283
Because you have " " around the sheet and cell reference BHR8732A2!P$16, it's going to be treated as a text string, not a cell reference. It's not going to change when you copy across.
If you want to just multiply the value in column S by the value in row 16, you'd write it as ='BHR8732A2'!P$16*$S283.
If you want to multiply the value in column S by the value in another cell whose address is in row 16, you'd write it as =INDIRECT('BHR8732A2'!P$16)*$S283.
Using a text string inside the Indirect is kind of the 'worst of both worlds', where you're just feeding the cell reference directly into the Indirect, which is unnecessary.
I'm not sure why the whole BHR8732A2!P$16 has quotes. Excel does not seem to recognise the P$16 part as a cell reference for me.
Try this: =(INDIRECT('BHR8732A2'!P$16))*$S283
I have this formula in excel, to return a row number:
=MATCH(INDIRECT(ADDRESS(ROW(),4)),DayOffRequests!$A$1:$A$100,0)
and it works just fine.
I would like to make a new name (DAYS_OFF_ROW) and assign it to this formula.
Here's what I did in the name manager:
But when I write this into a cell: =DAYS_OFF_ROW it says #VALUE! whereas when I write the same formula into the cell, it gives me the row number I am looking for.
Why is does it say #VALUE! and not the row number like the formula does?
First off Row() returns the row on which the cell resides. If you put Row() in indirect you will get an error since there is no cell for which Excel can find a Row(). So right off the bat, your formula is nonsense for a named range.
Second, even if there was some magic way for Excel to know which Row() you cared about here, Match doesn't return a range. Just a position in an array like "5" or "50". When you use a formula to define a named range, the result of the formula MUST be a range. So you could do another Indirect like =Indirect("A" & Match(foo,bar)) or something so that the result out of your formula actually refers to a range in your sheet.
It works if i set the name to this formula: =MATCH(!$D1,DayOffRequests!$A$1:$A$100,0)
Of course i have to be in field A1 when setting the name. Now its reference the fourth column and whichever row i am in.
I want to calculate the sum on a column and then subtract sum on another column BUT using only the values from a given row to the current row (the one in which formula resides).
So, in an "informal custom language", I would need something like this:
Suppose I am in C5: =(sum(A1:"A"+ROW())-sum(B1:"B"+ROW()))
How can I write a correct expression in Excel for this?
You can try using INDIRECT, which accepts a string reference to a range and returns the range itself:
=SUM(INDIRECT("A1:A"&ROW()))-SUM(INDIRECT("B1:B"&ROW()))
Here, we start with a 'stub' of "A1:A". We then get the current row with ROW() (so 5 in this example) and concatenate it with our stub, giving us INDIRECT("A1:A5"). Since INDIRECT will return the range referenced by its argument ("A1:A5" here), we can wrap it with the SUM formula to get the result (which is identical to SUM(A1:A5)). We then do the same thing for column B.
I think you may be looking at it backwards. You need to anchor the first cell reference in the call to SUM to the first row, but let the second cell reference change with the row. Try this in cell C1:
=SUM(A$1:A1) - SUM(B$1:B1)
Now when you copy that down the column, it becomes:
C2: =SUM(A$1:A2) - SUM(B$1:B2)
C3: =SUM(A$1:A3) - SUM(B$1:B3)
C4: =SUM(A$1:A4) - SUM(B$1:B4)
C5: =SUM(A$1:A5) - SUM(B$1:B5)
C5:= (SUM))-(SUM))
Try this:
C5:= (SUM(INDIRECT("A1:A" & ROW()))-(SUM(INDIRECT("B1:B" & ROW()))