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))
Related
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
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)
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
I have a named range called "ABI_Volume_Exposure" with numeric values and some #VALUE!-errors and I would like to retrieve the largest (and additionally, the second-largest) value within this named range.
I use the following array function:
=LARGE(IF(ISNUMBER(ABI_Volume_Exposure),ABI_Volume_Exposure),1)
However, the function doesn't work properly as it shows 0 as output while there is for example a value of 150 in the named range.
If I evaluate the function:
=LARGE(IF(ISNUMBER(ABI_VOLUME_EXPOSURE),ABI_VOLUME_EXPOSURE),1)
=LARGE(IF(ISNUMBER(#VALUE!),ABI_VOLUME_EXPOSURE),1)
=LARGE(IF(FALSE,ABI_VOLUME_EXPOSURE),1)
=LARGE(IF(FALSE,1)
=0
Can anyone point out what I am doing wrong?
Thanks in advance,
Huib
After a quick search: https://www.mrexcel.com/forum/excel-questions/605702-ignoring-na-formula.html
The Excel 2010 Aggregate function will work without using an array formula:
=AGGREGATE(4,3,ABI_Volume_Exposure)
4 tells it to return the maximum value.
3 tells it to ignore hidden rows, error values, nested subtotals and aggregate functions.
I think you have an error with this -> ().
I have tried this formula and it works fine.
In A1 I have a numeric value 1123.
And in the cell B1 I have this formula:
=LARGE(IF(ISNUMBER(A1),A1,1))
Good Afternoon,
I am trying to use and HLOOKUP to INDEX a variable column in a date/dollars report. Please look at my data and the formulas I have written.
The goal is to have a date in Q6 that will return the person's $'s spent in that month.
Here is the data and formulas I am using...
Fixed Value of Column to return "1-Dec-16" (Q6)
Row to Return "Billy" (Q8)
HLOOKUP(Q6,B1:O1,1) = 1-Dec-16
INDEX(M:M,MATCH(Q8,A:A,FALSE),1) = 12
Combining them (replacing the specific M:M callout) gives me a REF error
INDEX(HLOOKUP(Q6,B1:O1,1),MATCH(Q8,A:A,FALSE),1) = #REF!
Can anyone explain why this error is occurring or perhaps help me tweak the code to get the formula working. I appreciate any assistance.
It's because the HLOOKUP just gives a single value, but you need a whole column to go in the first part of the INDEX statement.
You could get the column by using index-match on the two-dimensional array A:O
INDEX(A:O,,MATCH(Q6,1:1,0))
and then use this in another index-match
=INDEX(INDEX(A:O,,MATCH(Q6,1:1,0)),MATCH(Q8,A:A,0))
but I think it's easier to find the row and column with MATCH statements and use just one INDEX to find the cell you want:-
=INDEX(A:O,MATCH(Q8,A:A,0),MATCH(Q6,1:1,0))