Using Vlookup inside Sumproduct - excel

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])

Related

Excel formula to use values from one table with comma separated values in another table

I am trying to use the values from Table 1 to populate Table 2 automatically but I am getting errors when I tried to use vlookup or the filter function. This is based on the fact that I am using full name (last name, first name). Is there a a better way to solve this problem?
Vlookup Formula: =VLOOKUP(G3,$A$3:$B$7,2,FALSE)
Filter Formula: =TEXTJOIN(", ",,FILTER(B:B,ISNUMBER(MATCH(A:A,FILTERXML(""&SUBSTITUTE(G3&", ",", ","")&"","//b"),0))))
Formula F3: =IFERROR(TEXTJOIN(CHAR(10);FALSE;VLOOKUP(TEXTSPLIT(E3;;CHAR(10);TRUE;1);$A$3:$B$7;2;FALSE));"")

How to manually map columns in Excel with different headers

I want to write a function similar to simple Index-Match or Vlookup-Match.
Problem:
The values of the "Kadabra" columns should be shown in the "Jam" column and the "Shadabra" column in the "Jim" column. Given that the Columns will have consistent headers(Jim, Jam, Kadabra, Shadabra) but their positions may change(which means we cannot use column numbers).
"Abra" and "Jimmy" are the index values.
I'm looking for an excel formula solution. If there isn't one then a Visual Basic solution is also welcome.
One way to achieve this would be to use an Index Match Match formula as below, if you were to enter this formula into cell B8:
=INDEX($A$1:$C$4,MATCH(A8,$A$1:$A$4,0),MATCH("Kadabra",$1:$1,0))
And in C8:
=INDEX($A$1:$C$4,MATCH(A8,$A$1:$A$4,0),MATCH("Shadabra",$1:$1,0))
Then you could fill the formula down and it should bring the appropriate values into your Jimmy/Jim/Jam Table.
First please check below screenshot:
I have created a match table at E:F in order to avoid nested IFs for that condition. You may move the match table to another sheet and change your formula accordingly.
Formula for B8 is as below. You may drag-copy it down and right:
=VLOOKUP($A8,$A$2:$C$4,MATCH(VLOOKUP(B$7,$E:$F,2,0),$A$1:$C$1,0),0)

VLOOKUP alternative using three lookup values

As you know Excel only lets you use one lookup value, but I need to compare three lookup values to find a fourth value.
For example in the screenshot below I want to use the information name, pet and business to find who the teacher is on the second sheet. For the record this is just example data to understand how to perform the task and I need to apply this to over 600 rows!
First sheet:
Here is the first sheet
Second sheet:
Here is my second sheet
Edit: I keep getting an error when I try to enter this formula: =index(Sheet2!A2:G7,MATCH(Sheet1!A5&Sheet!C5&Sheet1!D5,Sheet2!B2:B7&Sheet2!D2:D7&Sheet2!E2:E7,0))
Instead of Vlookup(), you can use Index/Match, which is a nice alternative that lets you do this.
The formula correctly returns "Miss Smith":
Note: This is entered as an array formula with CTRL+SHIFT+ENTER
So, the basic layout of the formula is:
=Index([range to return],match([single look up value],[range where that value would be],0))
You can combine lookup values by concatenating them, as you can see in the screenshot. So, the single lookup values are A2, C2, and D2. And, you'd expect to find "Sarah" in the range G2:G3, "Dog" in H2:H3, etc.
Please let me know if I can clarify anything.
Edit: To help visualize the two sheets thing. I put the table (which you will lookup from) on a sheet called "Data Sheet". The table we need to complete is on "Main WS".
Here's "Main WS":
and the "Data Sheet":
Given the cyclic calulation and disregard for the Worksheet.UsedRange property that the AGGREGATE function exhibits, you will want to cut down the ranges for the lookups to the minimmum required. Pick a column that will typically determine the extent of the lookup range and use that to define the end point of each lookup column.
Sheet2:
        
Sheet1:
        
The formula in Sheet1!E2 is,
        
Fill down as necessary.

Vlookup referring to table data in a different sheet

I would like to use a VLOOKUP function referring to a data table placed in a different sheet from the one where the VLOOKUP function in written.
Example: in Sheet 1, cell AA3 I would like to insert the VLOOKUP function.
I want the function to check the number in cell M3, find the same number in Sheet 2 range address A2:Q47 first column, and reproduce the value in the 13th column of that table.
I've written this function but it reports #N/A as a result:
=VLOOKUP(M3,Sheet1!$A$2:$Q$47,13,FALSE)
One of the common problems with VLOOKUP is "data mismatch" where #N/A is returned because a numeric lookup value doesn't match a text-formatted value in the VLOOKUP table (or vice versa)
Does either of these versions work?
=VLOOKUP(M3&"",Sheet1!$A$2:$Q$47,13,FALSE)
or
=VLOOKUP(M3+0,Sheet1!$A$2:$Q$47,13,FALSE)
The former converts a numeric lookup value to text (assuming that lookup table 1st column contains numbers formatted as text). The latter does the reverse, changing a text-formatted lookup value to a number.
Depending on which one works (assuming one does) then you may want to permanently change the format of your data so that the standard VLOOKUP will work
I faced this problem and when i started searching the important point i found is, the value u are looking up i.e M3 column should be present in the first column of the table u want to search
https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
check in lookup_value
Your formula looks fine. Maybe the value you are looking for is not in the first column of the second table?
If the second sheet is in another workbook, you need to add a Workbook reference to your formula:
=VLOOKUP(M3,[Book1]Sheet1!$A$2:$Q$47,13,FALSE)
There might be something wrong with your formula if you are looking from another sheet maybe you have to change Sheet1 to Sheet2 ---> =VLOOKUP(M3,Sheet2!$A$2:$Q$47,13,FALSE) --- Where Sheet2 is your table array
This lookup only features exact matches. If you have an extra space in one of the columns or something similar it will not recognize it.
I have faced similar problem and it was returning #N/A. That means matching data is present but you might having extra space in the M3 column record, that may prevent it from getting exact value. Because you have set last parameter as FALSE, it is looking for "exact match".
This formula is correct: =VLOOKUP(M3,Sheet1!$A$2:$Q$47,13,FALSE)
Copy =VLOOKUP(M3,A$2:Q$47,13,FALSE) to other sheets, then search for ! replace by !$, search for : replace by :$ one time for all sheets

Use cell text to build Excel formula

I'm trying to utilize a row and a column header to build a function that I can fill across an excel table (range of cells, not excel table object). So, for example I have a row header "BAT61" and column headers "A","B","C"...
I'd like to create a formula that generates the following results in those columns: =min(BAT61A),=min(BAT61B), =min(BAT61C)... Where those generated names match named ranges that have already been created.
I've attempted to use =index without success (I generally get a #ref error). I'd prefer a non-vba solution, if at all possible. Any help is appreciated.
UPDATE:
I've tried the indirect function but gotten the same #ref error. I've verified that the named range exactly matches the text string I'm trying to pass. I've tried the following variations with the same result #ref: =min(indirect(A1))[where A1 is the cell with "BAT61A"], =min(indirect(BAT61A))[to try and get the result directly], and =min(indirect(A1&A2))[where A1="BAT61" and A2="A"]. But, when I create a "Test" range, like suggested-it works. Any further ideas would be appreciated.
UPDATE2: I was able to get it working with several slight modifications. My named ranges that did't work were actually referring to fairly extensive array formulas that were parsing select rows from a table. When I created new dummy columns in the table that basically did the filtering, the indirect would pull the correct columns based upon the indirect.
Name some cells "Test" then you can use:
=MIN(INDIRECT("Test"))
http://www.cpearson.com/excel/indirect.htm
The name can be constructed using the & operator = $A1&B$2
For reference of others, use the function "Address" and "Indirect" in combination to achieve the above behavior.
Here is a sample for using values in cells to create formulas
=INDIRECT(ADDRESS(E6,K2))
Assuming cell
E6 holds 3 and
K2 holds 4
The above formula will return
=INDIRECT($C$4)
Assuming cell
C4 holds This is a test
The above formula will return
This is a test

Resources