Hi everyone I have a table of data that contains multiple matches when using vlookup. I was following a lesson that used a combination of vlookup, offset and match to return the second match. However, I am stuck in how I should return the third match.
I know index and match is probably better for this, but I was unable to follow how those expressions work.
My lookup table has 3 columns of data. The first column is a name that repeats with different data in columns 2 and 3. I want to lookup by name and return the content of column 2 and 3.
My expression for the first match is:
Column 2:=VLOOKUP($A3,Sheet1!$J$2:$L$4554,2,FALSE)
Column 3:=VLOOKUP($A3,Sheet1!$J$2:$L$4554,3,FALSE)
The expression for the second match is:
Column 2 data:
=VLOOKUP($A3,OFFSET(Sheet1!$J$2,MATCH($A3,Sheet1!$J$2:$J$4554,0),0,4600,3),2,FALSE)
Column 3 data:
=VLOOKUP($A3,OFFSET(Sheet1!$J$2,MATCH($A3,Sheet1!$J$2:$J$4554,0),0,4600,3),3,FALSE)
How can I use a similar formula to offset for the 3rd match and so on?
Array Formula Requires CTRL+Shift+Enter instead of normal enter
=IFERROR(INDEX(Sheet1!$J$2:$L$10,SMALL(IF(Sheet1!$J$2:$J$10=$A$3,ROW(Sheet1!$J$2:$L$10)-MIN(ROW(Sheet1!$J$2:$L$10))+1),ROWS($1:1)),COLUMNS($A:B)),"")
Related
I have an excel sheet that has data in 3 columns. I am trying to write a function that will search each column for a single value. If it finds the value, I want to output the value of the column where the value was found.
I have this formula currently, which does what I want for a single column, but I do not know how to modify it to search additional columns in the same row.
=IF(ISNUMBER(SEARCH("apples",J2)),J2,"")
I tried modifying it to:
=IF(ISNUMBER(SEARCH("apples",I2:J2)),J2,"")
But then I received an excel error saying #SPILL
I want to search columns I2:J2 for the word "apples" and if found, output the value in cell J2
How can I modify my function to do this?
XLOOKUP() may be best fit for you. Try-
=XLOOKUP("Apple",I2:I10,J2:J10,"Not Found",0)
In case of partial match use match_mode parameter 2 for wildcard character match like-
=XLOOKUP("*Apple*",I2:I10,J2:J10,"Not Found",2)
Try this (in rows 1 TO 10 as an example):
=INDEX($J$1:$J$10, MATCH("apples",$I$1:$I$10,0))
"The range where the lookup value is located. Remember that the lookup value should always be in the first column in the range for VLOOKUP to work correctly. For example, if your lookup value is in cell C2 then your range should start with C."
But sometimes I want to be able to do dual-direction lookups. Ie, lookup using a key in column A to get the value in column B AND at the same time, in other formulas, lookup the value in B to get the value in A.
The only way I know is to add a column C which mirrors A, then use AB for the first lookup, and BC for the second lookup. But there has to be some cleaner solution. Is there some way to force VLOOKUP to use a different column other than the first one to find the key value, or is there a different function that would allow the equivalent?
As a side note, I am asking about Excel, but I actually use LibreOffice. Presumably the functions should be identical, but an answer that also works in LibreOffice would be preferable.
INDEX/MATCH will do it any direction of search.
So for your example of B --> A:
=INDEX(A:A,MATCH(yourCriteria,B:B,0))
The MATCH returns the row number of the match. The third Criterion of 0 is optional. The 0 is the same as FALSE for the forth criterion of VLOOKUP, in that it looks for an exact match.
The default is 1 with the data sorted it will return the match that is less than or equal to the criteria Like VLOOKUP's TRUE.
From that the INDEX finds and returns the correct value.
With the introduction of the Dynamic Array formula XLOOKUP we can use:
=XLOOKUP(yourCriteria,B:B,A:A,"",0)
I work with a kind of fuzzy match filter, based on additional column with a filter list. The formula is:
=IF(SUMPRODUCT(COUNTIF(A2,"*"&B$2:$B$22&"*"))>0,"Delete","Keep")
In fact there are two formulas, they work on the same kind - they were created on experimenting. The second is:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH($B$2:$B$22,A2))),"Delete","Keep")
Column A contains data to filter,
column B (from B2 to B22) contains the filter list,
in the column C i write "keep", if there is no partly match of the value from column A with values from column B, and write "delete", if there is any partly match.
Q: how to write instead of "delete" the matching value from column B? I can't get this work in both of formulas.
Update
After translation of formula by #Jerry
=IFERROR(INDEX($B$2:$B$22,MATCH(9^99,SEARCH($B$2:$B$52,A2))),"Keep")
to
=WENNFEHLER(INDEX($B$2:$B$22;VERGLEICH(9^99;SUCHEN($B$2:$B$52;A2)));"Keep")
with this translation tool (worked for me in other cases errorfree), i get following result:
which is another, than the result by Jerry.
If there can be only 1 match, then you can use INDEX and MATCH in an array formula (use Ctrl+Shift+Enter and you will see curly parens around the formula in the formula bar if you did it right):
=IFERROR(INDEX($B$2:$B$22,MATCH(9^99,SEARCH($B$2:$B$22,A2))),"Keep")
If there are more than one match, you will get the last match with the above formula. If you wish in that case to return the first formula, you will have to use --ISNUMBER around the search function, use 1 for the first parameter of MATCH and use exact match (i.e. use 0/FALSE for the 3rd parameter of MATCH.
Of course, you can use COUNTIF(A2,"*"&B$2:$B$22&"*") instead in that case for the inner part of the formula instead of --ISNUMBER(...).
For all who is interested: this formula does the trick:
=IFERROR(LOOKUP(9.99E+307,SEARCH(B$2:B$22,A2),B$2:B$22),"Keep")
I am using index(match(match to find a value based on two different criteria. There are many results that will populate, I just want to return the first result. What do I need to add to my Index Match formula in order to return the first result that matches?
Below is my code and a breakdown with images:
=INDEX(Master_Query[Current Balance On Hand],MATCH('Waterfall 2018'!$R$1086,Master_Query[Part Number],0),MATCH($BX$1,Master_Query[Date],0))
Cell H1086 is were i need the result to return. I need it to match the highlighted criteria: Part Number in cell R1086 and Date in cell BX1
This is the table that we get the results from, as you can see there are many results that match the criteria in the formula, i just want to return the first one since they are all the same.
Note: The date column is filtered; there are multiple dates that will result in different "current balance on hand"(column D) results, thus I cannot use a vlookup formula. I just filtered it to make it easy to understand my problem.
Attempt 1
Attempt 1(2)
The second Match looks for the column number in the index formula. So it doesn't do what you want.
One alternative is to add a column to the ELX forecast table that merges the "Date" column and the "Part number"
The formula of that column would be:
After that, in your waterfall sheet, replace your current index/match formula with:
=INDEX(Master_Query[Current Balance On Hand],MATCH(BX$1 & $R1086,Master_Query[Merged column],0))
I have a data source in the format as the one below. In reality, that would contain few thousand rows.
I need to use something like INDEX-MATCH-MATCH in order to be able to get the "Status" for each "Content" item for each UserID.
The final result should look like this. The first two columns are not dynamic.
The INDEX formula goes to C and D.
I am using the following sequence to try and write the formula, but I don't seem to understand where the problem is.
=INDEX(Sheet1!A:K, [Vertical Position], [Horizontal Position])
look up the user with ID xxx:
=INDEX(Sheet1!A:K, MATCH(A2, Sheet1!A:K,0), [Horizontal Position])
look up the status for eLearn1.
=INDEX(Sheet1!A:K, MATCH(A2, Sheet1!A:K,0), MATCH("Status", Sheet1!A:K,0))
What am I doing wrong?
The question is not clear, but I think you are trying to do a LOOKUP based on the values of two columns. So for a particular value of Column A (UserID) and Column B (Content) you need to return Column H (Status).
This can be done using an array formula to return the row number of the matching line which can be fed into INDEX. Note, that this will only work as long as Columns A&B only have unique pairings.
I have set up some sample data:
Columns A-C are my source data. Cells G2:H4 are the lookup.
The formula is:
=INDEX($C$1:$C$7, SUM(($A$1:$A$7=$F2)* ($B$1:$B$7=G$1)*ROW($C$1:$C$7)))
This needs to be entered as an array formula by pressing CTRL-ALT-ENTER.
The formula works by matching the value you are searching for in both arrays and multiplying out the results. This should give you a result array consisting of all False with one True indicating the matched row. This is then multiplied against the row number to return the correct row to the INDEX formula.