VLOOKUP inside VLOOKUP formula to find table_array - excel

Is it possible to insert a VLOOKUP inside a VLOOKUP formula, to search for a specific table_array?
This is the formula I want to use:
=VLOOKUP($F492,CONCATENATE("'[Budget estimate Mar 2016 v2.xlsm]",VLOOKUP($I492,Sheet2!$C$3:$D$73,2,0),"'!$B$23:$T$116"),8,0)
The reason I used CONCATENATE is so table_array does not change when I drag the formula down, but worksheet name changes.
The problem is VLOOKUP returns me a value error. Should I insert some another function to change it to text?
What I want to have inside the VLOOKUP is table_array. Normally you have:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]).
My table_array changes depending on specific value in column "I". The way it changes, it just changes the name of the worksheet, so if I have a table array:
'[Name1'!B23:T116 for value "example1",
I want it to change to:
'[Name2'!B23:T116 for value "example2".
That's why I used CONCATENATE, so the VLOOKUP will look for a specific Name"x" and CONCATENATE will join B23:T116.

Not sure it does what you require, but the syntax is OK:
=VLOOKUP($F492,INDIRECT("'[Budget estimate Mar 2016 v2.xlsm]"&VLOOKUP($I492,Sheet2!$C$3:$D$73,2,0)&"'!$B$23:$T$116"),8,0)

I think you'll probably need to put that CONCATENATE function and its contents inside an INDIRECT function.

Related

SUMIFS where the "sum_range" column is unknown

I have a pile of data on Sheet1
I have a SUMIFS formula on Sheet2
The columns I am summing are named NETPERD1, NETPERD2, NETPERD3.....NETPERD12
I want to write the SUMIFS so that I can easily change which column I am summing.
On Sheet2, in cell $C$4, I will enter NETPERD1 or NETPERD2 etc. and I want my SUMIF to determine which column it should sum.
I think I should be able to do this with IndexMatch but I can't get it to work.
Here is my SUMIFS that works.
I want to replace NETPERD1 with $C$4
=SUMIFS(Sheet1!NETPERD1,Sheet1!ACCTGRPCOD,Perplas!$A15,Sheet1!AUDTORG,Perplas!C$1,Sheet1!FSCSDSG,Perplas!C$2,Sheet1!FSCSYR,Perplas!C$3)
If your named ranges span the entire column, then for the INDEX/MATCH try:
=SUMIFS(INDEX(Sheet1!$A:$Z,,Match(Perplas!C$4,Sheet1!A$1:Z$1,0)),...
changing the Z to your rightmost column.
Try using the indirect function. You can supply indirect with a character string that Excel then reads as part of a cell/range reference.
Working off the code you shared + the fact that you said that you'll put in the name of the range in cell C4:
=SUMIFS(INDIRECT("Sheet1!"&$C$4),Sheet1!ACCTGRPCOD,Perplas!$A15,Sheet1!AUDTORG,Perplas!C$1,Sheet1!FSCSDSG,Perplas!C$2,Sheet1!FSCSYR,Perplas!C$3)
I think that should work? I'm a little confused about how you're able to reference the row name without a named range, so that might cause a wrinkle in this.

Using Vlookup inside Sumproduct

I have a table named "Open" that contains values of DPL_900, DP_950, etc. I want to calculate the sum of multi between quantity and each value of DPL_900, DP_950 which "Vlookup" in Open table. So I typed in the cell K98 that formula:
{=SUMPRODUCT(K93:K97,VLOOKUP(L93:L97,Open,2,0))}.
I thought that formula would work but it does not.
I think you do not need any VLookup(). Use following formula. Here Open is table name with header.
=SUMPRODUCT(B2:B6,(Open[Cat]=C2:C6)*Open[Num])

Excel array formula with wildcard

I have an array formula that refers to a drop down cell ($AG$7) to determine which cells to evaluate. This works well, however, I need to include an additional item in the drop down which is "All".
When this is selected, I want the array formula to use "*" to return all instances from the array, but i can't get it to work.
This is the formula I'm currently using;
={SUM(IF((tblSkillsMatrix[Role]=[#Role])*(INDIRECT("tblSkillsMatrix["&V$2&"]")=$AG$7),1,0))}
I've tried using
={SUM(IF((tblSkillsMatrix[Role]=[#Role])*(INDIRECT("tblSkillsMatrix["&V$2&"]")="*"&$AG$7),1,0))}
and
={SUM(IF((tblSkillsMatrix[Role]=[#Role])*(INDIRECT("tblSkillsMatrix["&V$2&"]")="*"&$AG$7&"*"),1,0))}
But these don't work.
Does anybody have any ideas?
Thanks
A explicit = comparison cannot use wildcards. COUTIFS and SUMIFS can. As far as I see, you want to count only (conditional sum 1 and 0).
Problem is, COUTIFS and SUMIFS will not deal with INDIRECT ranges. But INDIRECT can and should (because of its volatile bahavior) often replaced by INDEX- MATCH.
So:
=COUNTIFS(tblSkillsMatrix[role],[#role],INDEX(tblSkillsMatrix,,MATCH($V$2,tblSkillsMatrix[#Headers],0)),"*"&$AG$7)
If $AG$7 is empty then it counts independent of the column named in $V$2.
Btw.: Within a table (ListObject) this needs not be entered as a array formula.
This is not 100% replacement of your formula since it not works if $V$2 is empty and so no table column title is given. Your formula will then look at all columns but this is not possible using COUNTIFS where each additional range must have the same number of columns as the criteria_range1 argument. So if $V$2 shall also can be empty, then this will not work.
If so then you could use
{=SUM((tblSkillsMatrix[role]=[#role])*(LEFT(INDIRECT("tblSkillsMatrix["&$V$2&"]"),LEN($AG$7))=$AG$7))}
Advantage: both $V$2 and $AG$7can be empty.
Disadvantage: Volatile behavior of INDIRECT and this formula then must be a array formula even in a ListObject-table. It must be confirmed using Ctrl+Shift+Enter.

excel vlookup lookup_range cell contains a formula

I have a straightforward formula in Excel 2010 as follows:
=VLOOKUP(D597,'Sheet1'!$AA$3:$AC$5000,3,FALSE)
The problem is the lookup_range, D597 in this case, contains a formula, not text or numbers (it is actually a reference to another sheet and cell).
The lookup is returning #N/A . I know the value is in the named range, column aa, and the value I want in column 3.
Is there a way to use vlookup, or another function, to accomplish this fairly straightforward lookup?
With help from a friend, Master Joe, I was able to pull the value underlying D597 in the above vlookup formula. The solution:
VLOOKUP(VALUE(TRIM(D597)),'Sheet1'!$AA$3:$AC$5000,3,FALSE)

Reusing of formula driven result in a if statement in excel

=IFERROR(IF((INDEX(named range1,MATCH(named range2&A1,named range3,0)))<>"",INDEX(named range1,MATCH(named range2&A1,named range3,0)),"-"),"")
Here in this formula I am trying to vertical lookup a value using index-match and checking it within a if statement for blank value.If it is not blank I am using the non-blank value to set it in a given cell.
How can I optimise my formula to reduce performance overhead in excel.
I don't want to use vba for this by storing the result in a variable
The most time consuming bit is the Match(), so avoiding a duplication of the same Match is key. You can
place the Index/Match in a helper cell and then use the formula
=IFERROR(IF(B1<>"",B1,"-"),"")
This way the Index/Match will be calculated only once.
place the Match into a named formula. If you keep your wits about you, named formulas can work with relative cell references. Select the cell where you want the formula to go, then create a named range "NamedRange4" with the formula
=MATCH(named range2&A1,named range3,0)
Then use this formula in the selected cell:
=IFERROR(IF((INDEX(named range1,NamedRange4))<>"",INDEX(named range1,NamedRange4),"-"),"")
The Match will be calculated only once and the result stored in the named range. With relative cell referencing of NamedRange4, the IfError formula can be used in other cells with correct results.

Resources