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

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));"")

Related

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

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)

Using a vlookup or index match inside a sumproduct function

I have two 2-D arrays that relate to engines. The first table classifies an Engine as either a or as b. The second table has a numerical count value for each of the engines.
I want to calculate the number of engines for each label. Here, label a has a count of 40 and label b has a count of 300.
I thought the following formula would work...
=SUMPRODUCT(
--(E3=VLOOKUP(A11:A17,A2:B8,2,0)),
B11:B17
)
...but it does not!
Why can't I use a vlookup inside a sumproduct array formula? Index-match also doesn't work.
I can't append a new column to the second table with a vlookup forumla that references the first table.
Use LOOKUP:
=SUMPRODUCT(($B$2:$B$8=E3)*LOOKUP($A$2:$A$8,$A$11:$A$17,$B$11:$B$17))
To do it with unsorted data use this array formula:
=SUM(SUMIF($A$11:$A$17,IF($B$2:$B$8=E3,$A$2:$A$8),$B$11:$B$17))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.

Excel Countif with multiple if requirements

I have an Excel document that has a date column (A) and a column containing strings (B) one one sheet. On another sheet, I am doing calculations. If the cell in column A is between DATE(2012,1,1) and DATE(2012,6,1) AND the same row in column B contains "string" in any part (string) then it should count that row. Google mentioned using SUMPRODUCT but I was only able to get date between to work. Below is the SUMPRODUCT for date between.
=SUMPRODUCT(--('Sheet1'!A:A>=DATE(2012,1,1)),--('Sheet1'!A:A>=DATE(2012,6,1)))
I tried using this for the final value but it is incorrect.
=SUMPRODUCT(--('Sheet1'!A:A>=DATE(2012,1,1)),--('Sheet1'!A:A>=DATE(2012,6,1)),--('Sheet1'!B:B="*"&"string"&"*"))
EDIT: Apparently the above works, but the string must be EQUAL to the value. * is not being recognized as a wildcard.
Thanks.
If you are using whole columns in SUMPRODUCT you must have Excel 2007 or later (otherwise that doesn't work), and you can use wildcards in COUNTIFS
=COUNTIFS('Sheet1'!A:A,">="&DATE(2012,1,1),'Sheet1'!A:A,"<="&DATE(2012,6,1),'Sheet1'!B:B,"*String*")
The issue you're running into is due to the fact that you can't use wildcards in that way in a SUMPRODUCT. A way that you can get around it (assuming you need to use SUMPRODUCT) is to use either SEARCH or FIND to create the necessary array for use in the SUMPRODUCT. Here is an example that has your target string in cell D1 (note that this needs to be entered as an array formula with Ctrl+Shift+Enter):
=SUMPRODUCT(
--(Sheet1!A:A>=DATE(2012,1,1)),
--(Sheet1!A:A<=DATE(2012,6,1)),
IFERROR(IF(SEARCH(D1,Sheet1!B:B)>0,1,0),0))
IFERROR accounts for the non-matches but is an Excel 2007 feature. If you're not using Excel 2007, you can try:
=SUMPRODUCT(
--(Sheet1!A:A>=DATE(2012,1,1)),
--(Sheet1!A:A<=DATE(2012,6,1)),
IF(ISERROR(IF(SEARCH(D1,Sheet1!B:B)>0,1,0)),0,IF(SEARCH(D1,Sheet1!B:B)>0,1,0)))
Also, in your example formula, you'll need switch the sign to <= in the comparison to June :)
Sumproduct does not allow for wildcards. You can search for strings using ISNUMBER(SEARCH("string",range)). The formula is below.
=SUMPRODUCT(--('Sheet1'!A:A>=DATE(2012,1,1)),--('Sheet1'!A:A<=DATE(2012,6,1)),--(ISNUMBER(SEARCH("string",'Sheet1'!B:B))))
What version of Excel are you using? If it is 2007 or later, you can use COUNTIFS; here is a link to the syntax. You may have to use two columns, even using COUNTIFS. On Sheet2, column A should check whether Sheet1, column B contains "string" using the following formula:
=IF(ISERR(FIND("string",'Sheet1'!B1)), FALSE, TRUE)
You will need to replace 'Sheet1'!B1 with whatever cell you need, then drag it down to make it have the same number of rows as your Sheet1, column B. Then you can use COUNTIFS:
=COUNTIFS('Sheet1'!A:A, ">=" DATE(2012,1,1), 'Sheet1'!A:A, ">=" & DATE(2012,6,1), A:A, TRUE.

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