INDEX MATCH on structured references / #value error - excel

The use of INDEX / MATCH on 2 defined tables and a structured reference on their columns causes a #value error, although the function has been entered as an array-function.
Given:
**Table1:**
Key1|SourceVal
1|A
2|AA
**Table2:**
Key2|ValDisp
1|_{=INDEX(Table1;MATCH(Table2[#[Key2]];Table1[Key1];0);Table1[SourceVal])}_
The formula entered in column "ValDisp" effects in a #value error.
The formula analyzer shows, that the correct value is found, but is turned into #value during the last step.

INDEX can be invoked in two ways. In the way you are using it, first parameter is a range, and second and third parameters are numbers.
You are using =INDEX(Table1;MATCH(Table2[#[Key2]];Table1[Key1];0);Table1[SourceVal])
Last parameter Table1[SourceVal] does not return a number, so try to replace it with column number:
=INDEX(Table1;MATCH(Table2[#[Key2]];Table1[Key1];0);2)
Another option would be using a second MATCH that searchs for the name of the column and returns its position inside headers area of Table1. Something like this:
I got Excel 2007 so my structured references are different. Not # like in Excel 2010 and higher
You could replace the 2 by MATCH(Table1[[#HEADERS];[Sourceval]];Table1[#HEADERS];0)

Related

Index Match Result #Ref

I don't understand why I am getting the #Ref error while I am using exactly the same formula as follows:
=INDEX(D2:D82,MATCH(L15,A2:A82,0),MATCH(M13&M14,C2:C82&F2:F82,0)) - this gives me the value I need "FT1"
=INDEX(D2:D82,MATCH(L15,A2:A82,0),MATCH(N13&N14,C2:C82&F2:F82,0)) - the was supposed to give me the value "WT3" but results #Ref. Similarly the following two formulas give me the #Ref error
=INDEX(D2:D82,MATCH(L15,A2:A82,0),MATCH(O13&O14,C2:C82&F2:F82,0)), which was supposed to give me "FT3"
=INDEX(D2:D82,MATCH(L15,A2:A82,0),MATCH(P13&P14,C2:C82&F2:F82,0)), which was supposed to give me "WT1"
The source table is:
The result table is:
The second part of INDEX is for the column, you only need the row.
If you want to match on all 3 columns, i.e. A, C and F, try this.
=INDEX($D$2:$D$82,MATCH($L15&M$13&M$14, $A$2:$A$82&$C$2:$C$82&$F$2:$F$82,0))
If you are using Office 365 you could use the FILTER function instead of INDEX/MATCH.
=FILTER($D$2:$D$82, ($A$2:$A$82=$L15)*($C$2:$C$82=M$13)*($F$2:$F$82=M$14))

Using Index and match returning error: 'A value is not available to the formula or function'

I am trying to use Index and match combination to retrieve values in a column where the date from my table matches the date from another table. This is the formula:
=INDEX(BTL!A2:G262, MATCH(A2, BTL!A2:G262,0), MATCH("Overbooked?", BTL!B1:G262))
This is the table where I am using the formula:
This is the BTL table:
The error that is being returned is 'A value is not available to the formula or function'.
What's the reason for this?
The MATCH function returns the position of the lookup value in a 1-dimensional array. Imagine a row or a column. =MATCH(A2, BTL!A2:G262,0) will return an error because A2:G262 is a 2-D array. =MATCH(A2, BTL!A2:A262,0) has correct syntax but may still return an error if A2 isn't found. The absence of absolute referencing (like =MATCH(A2, BTL!$A$2:$A$262,0) makes the formula unfit for copying.
The same applied to MATCH("Overbooked?", BTL!B1:G262), except that B1:G262 isn't anywhere near the range you want to search. I think you mean the column and, therefore, must search in B1:G1.
Of course, if either of your MATCH functions returns an error the entire formula can't return a proper result either. Test the MATCH functions separately before inserting them into your INDEX function. You can also select them in the finished formula and press F9. Finally, you may like to guard against that by enclosing the formula in an IFERROR() function.
=IFERROR(INDEX(BTL!A2:G262, =MATCH(A2, BTL!A2:A262,0), MATCH("Overbooked?", BTL!B1:G1, 0)),"ERR")
I managed to resolve this by selecting the date column in the table where I was using the formula and using the 'text to columns' feature under the data tab. I selected the 'column data format' as 'date' and DMY

INDEX/MATCH with 4 columns

I have an Excel file with 2 sheets - one sheet contains my items, prices, codes, etc. and the other sheet is for cross-matching with competitors.
I've included an Excel file and image below.
I want to be able to generate my code automatically when manually entering any of my competitor's codes. I was able to do INDEX/MATCH but I was only able to match with one column (I'm assuming they're all in one sheet to make it easier). Here is my formula:
=INDEX(C:C,MATCH(K2,E:E,0)
So this is looking only in E:E, when I tried to enter a different column such as C:C or D:D it returns an error.
I tried to do the MATCH as C:G but it gave an error right away.
The reason why match gave you error is because it's looking for an array and you put in multiple columns.
There is definitely a more elegant way to do this but this is the first one that I came up with.
=IFERROR(INDEX(B:B,MATCH(K2,C:C,0)),IFERROR(INDEX(B:B,MATCH(K2,D:D,0)),IFERROR(INDEX(B:B,MATCH(K2,E:E,0)),IFERROR(INDEX(B:B,MATCH(K2,F:F,0)),IFERROR(INDEX(B:B,MATCH(K2,G:G,0)),"")))))
Index/Match Combination
Please try this formula:
{=INDEX($B$2:$B$5,MATCH(1,(K2=$C$2:$C$5)+(K2=$D$2:$D$5)+(K2=$E$2:$E$5)+(K2=$F$2:$F$5)+(K2=$G$2:$G$5),0))}
Instruction: Paste the formula {without the curly brackets} to the formula bar and hit CTRL+SHIFT+ENTER while the cell is still active. This will create an array formula. Hence, the curly brackets. Please take note though that manually entering the curly brackets will not work.
Description:
The INDEX function returns a value or the reference to a value from within a table or range.1
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.2
Syntax:
The INDEX function has two forms—Array and Reference form. We're going use the Reference form in this case.
INDEX(reference, row_num, [column_num], [area_num])1
MATCH(lookup_value, lookup_array, [match_type])2
Explanation:
To simplify, we're going to use this form:
INDEX(reference, MATCH(lookup_value, lookup_array, [match_type]))
The INDEX function returns a value from the reference My code column (B1:B5) based on the row_num argument, which serves as an index number to point to the right cell, and we're going to do that by substituting row_num with MATCH function.
MATCH function, on the other hand, returns the relative position of a value in competitorn column that matches the value in individual cells of the competitor code column.
To make it work with multiple lookup range, we're going to create arrays of boolean values (TRUE/FALSE, aka logical values) by comparing values from individual cells in competitor code column with values in individual competitorn columns. Now, we convert these boolean values into numerical values by performing a mathematical operation that does not alter its implied value (i.e. TRUE=1, FALSE=0). We're going to add these values directly to make it simple. The resulting array have four index with two possible values: 1 or 0. Since each item in MATCH's lookup_array is unique, then there can be only one TRUE or 1. The rest are FALSE or 0's. So, with that knowledge, we're going to use it as our lookup_value.
Let's dissect the formula:
=INDEX(B2:B5,MATCH(1,(K2=C2:C5)+(K2=D2:D5)+(K2=E2:E5)+(K2=F2:F5)+(K2=G2:G5),0))
My code 2 = INDEX({"My code 1";"My code 2";"My code 3";"My code 4"},MATCH)
My code 2 = INDEX({"My code 1";"My code 2";"My code 3";"My code 4"},(2))
2 = MATCH(1,(K2=C2:C5)+(K2=D2:D5)+(K2=E2:E5)+(K2=F2:F5)+(K2=G2:G5),0)
2 =MATCH(1,
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;TRUE;FALSE;FALSE},0))
OR
=MATCH(1,
{0;0;0;0}+
{0;0;0;0}+
{0;0;0;0}+
{0;0;0;0}+
{0;1;0;0},0))
=========
{0;1;0;0},0))
2 = MATCH(1,{0;1;0;0},0))
I hope this answer is helpful.
References and links:
INDEX function
MATCH function
Create an array formula

Index Small and If in Excel for multiple criteria

Hi All I have been trying to use the formula below and to alter it for multiple conditions
{=INDEX($C$1:$C$51,SMALL(IF($A$1:$A$51="Adeline",ROW($A$1:$A$51),""),3),1)}
I have a table on sheet1 called Data and a page for calculations. There is a matching ID on both sheets though in the table on sheet1 an ID could be on multiple rows. Also the CODE column could contain in this case TEST2 multiple times for same ID but with different Values. I am trying to in this case find the 3rd value for this combination.
So I trying to find out a value based on ID and a column called Code but I would like the 3rd value
So I've tried altering the IF part of the statement
{=INDEX(Data[Value],SMALL(IF((Data[ID] =[#ID])*(Data[CODE] = "Test2") ,ROW($A$1:$A$51),""),3),1)}
and
{=INDEX(Data[Value],SMALL(IF((AND(Data[ID]=[#ID], Data[CODE] = "Test2") ,ROW($A$1:$A$51),""),3),1)}
Both Come up with errors - any advice or am I looking at this completely in the wrong way.
Sample Data
Calcs sheet
EDIT Change from Largest being the highest rank to Smallest being the highest rank
=IFERROR(AGGREGATE(15,6,1/(1/((Data[[ID]:[ID]]=Results[#[ID]:[ID]])*(Data[[Code]:[Code]]="Test 2")))*Data[[Value]:[Value]],COLUMNS($A:A)),"")
Notes:
We use multiplication of Booleans instead of an IF function
the 1/(1/(...)) formula part is a method of turning FALSE results from the Boolean multiplaction from 0 into a #DIV/0! error.
The AGGREGATE function provides a method of excluding the error results from the calculation.
Structured references have been changed to absolute references to allow dragging without changing the column names
The COLUMNS(... function will adjust to return {1,2,3] as you fill right to return the smallest; 2nd smallest, etc value
Note that with an absolute reference, the table name must be used even if the line is in the same table.

VLOOKUP Resulting in #REF

I have the following set up in Excel, and I am attempting to lookup the first column in the range A5:A7, and return column 8 (the rate) plus the custom rate.
I am using the following thus far and it returns the #REF! error.
=G11+VLOOKUP(A11,$A$5:$A$7,8)
So for instance, to in row 11, I am trying to find the word Flash under the Type in the range A5:A7, and return the rate that it has (column #8 or H).
It should result in $0.26.
I am new to Excel, so any help is appreciated! :)
You should use this one instead:
=G11+VLOOKUP(A11,$A$5:$H$7,8,0)
Note, that I use $A$5:$H$7 intead $A$5:$A$7. Second change is to add 4th parameter equals to 0. When this parameter is FALSE or 0, VLOOKUP will only find an exact match. In this case, the values in the first column of $A$5:$H$7 do not need to be sorted. But when you ommit this parameter - VLOOKUP searches for exact/approximate match and values should be sorted.

Resources