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

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

Related

INDEX MATCH on structured references / #value error

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)

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

Excel formula that combines MATCH, INDEX and OFFSET

I am having trouble with an Excel-function.
On sheet A I want to get the value of a cell that is located x-columns to the right of cell F2.
X is a variable number and is determined by the value of cell A1. Currently, the value is 5.
=(OFFSET(sheetA!F2,0,sheetA!A1))
This formula works. However, I want to include this function into a MATCH and INDEX function that is located on another sheet (B).
I know that I can use the following formula to get value of $F$2
INDEX(sheetA!F:F,MATCH(sheetB!C4,sheetA!A:A,0))
Combining them, results in the following formula:
=INDEX((OFFSET(sheetA!F2,0,sheetA!A1)),MATCH(sheetB!C4,sheetA!A:A,0))
This formula generates a #REF!-value.
If I evaluate the formula, I see the following steps:
=INDEX((OFFSET(sheetA!$F$2,0,5)),MATCH(sheetB!C4,sheetA!A:A,0))
=INDEX((sheetA!$K$2),MATCH(sheetB!C4,sheetA!A:A,0))
=INDEX((sheetA!$K$2),MATCH("BTC",sheetA!A:A,0))
=#REF!
Why do I want to use MATCH and INDEX?
Because while the values on sheet A are "fixed", the values of sheetB!C4 are floating/variable. Therefore, I need to locate the correct row first. The correct column can be done with the offset-part.
Thank you for your help.
Try this
=INDEX((OFFSET(SheetA!F:F,0,SheetA!A1)),MATCH(SheetB!C4,SheetA!A:A,0))
Syntax of INDEX is
INDEX(array, row_num, [column_num])
where, array is range of cells. When you use =INDEX((OFFSET(sheetA!F2,0,sheetA!A1)),MATCH(sheetB!C4,sheetA!A:A,0)), (OFFSET(sheetA!F2,0,sheetA!A1)) returns sheetA!$K$2 which is a cell not a range.

Error using Vlookup function in Excel

I have the following data set:
I calculate the maximum return using =max(B2:B13) in cell D3 (i.e., 13.55%), and then I would like to find the date where this maximum return was realized. Thus, I use =vlookup(D3;A2:B13;1;FALSE), and I get as a result #N/A, which is clearly wrong. How can I make this work?
You can't use a VLOOKUP to find a value that isn't in the first column of your data table. Use an INDEX/MATCH formula instead:
=INDEX(A2:A13,MATCH(MAX(B2:B13),B2:B13,0))
A VLOOKUP is a Vertical Lookup - and is used to look up a value in the first column of a table and return a corresponding value from another column in that table (just like looking at a timetable for example).
You are trying to find the max value from column B, in column A - where it doesn't exist so you're not going to find it. In order to use a VLOOKUP the lookup_value must be in the first column of the data table.
If you want to look up a value in another column of the data table, then you need to use =INDEX(MATCH()) instead.

Function =VLOOKUP(MAX(B5:B11);A4:B11;1;1) Excel 2010

I need to get title of the cell to the left of the higher value of the column.
=VLOOKUP(MAX(B5:B11);A4:B11;1;1)
I use this command, but return: #N/A!
This is the capture of the spreadsheet
You are using an approximate match for the range_lookup parameter of the VLOOKUP function. An approximate match can only be performed on sorted data.
Additionally, you need an INDEX/MATCH function pair when the lookup column is to the right of the retrieved data.
=INDEX(A$4:A$11; MATCH(MAX(B5:B11); B$4:B$11; 0))
A better method may be to also retrieve the column of data from B5:G11 using a match to the column header labels in B4:G4 from A15:A20.
    
Your maximum formula in G15 would be,
=MAX(INDEX($B$5:$G$11; ; MATCH(A15; $B$4:$G$4; 0)))
To retrieve the associated comments, use this in B15,
=INDEX($A$5:$A$11; MATCH(G15; INDEX($B$5:$G$11; ; MATCH(A15; $B$4:$G$4; 0)); 0))
Fill the two formulas down to retrieve the results in the other rows.
btw, the highlighting in the sample image was created using a conditional format for B5:G11 based on the formula =B5=MAX(B$5:B$11).

Resources