How to use index and match with two columns? - excel

I have the following case
E.g., I want the two cells in yellow to be the same. For this, I need to find the columns Score 1 and Result, and then find the row 03-Jan so that I get the actual score. Do you have any idea how to solve this? I tried with some match and index but I do not get the solution.

Use INDEX with three matches, the first to find the correct row, while the other 2 find the correct column.
=INDEX($E:$N,MATCH($Q9,B:B,0),MATCH(R$8,$E$2:$N$2,0)+MATCH(R$7,$E$3:$I$3,0)-1)

You want to use an Index(Match),Match())
but what you really want to use is a double XLOOKUP.
I also liked this video to help me learn all of the ways to do a 2d lookup.
YouTube Video

Related

How to find first unique value in a column of SKU?

So I have two columns, A & B, (like below). There's 2 components to the ID, the design (CEN101A) and the size (-6).
I'm trying find the first item of each design. So in this example, I would highlight (CEN106A-6, CEN101B-6, CEN101D-6, etc.). This is so I can use them as a parent for the other sizes.
I've tried many in-built functions but nothing seems to work. Is VBA able to easily find these values?
#BigBen is right, this is fairly easy if you can find what the actual design code is. For good measure I'd use a running count and add the hyphen back including a wildcard into the COUNTIF():
Formula for conditional formatting rule on range A2:A7:
=COUNTIF(A$2:A2,#TEXTSPLIT(A2,"-")&"-*")=1
Without TEXTSPLIT(), use a combo of LEFT() and FIND() as per the comment by #P.b:
=COUNTIF(A$2:A2,LEFT(A2,FIND("-",A2))&"*")=1

How to achieve return of one value with multiple criteria

What I'm trying to achieve: Return one value by multiple criteria (from 2 cells).
How: Intersection of particular row or column.
Based on picture, Row=Units Sold , Column=Years(2011,2012,2013,Total)
I tried using INDEX+MATCH because it sounded like what I'm looking for. But it doesn't allow multiple criteria, or at least I've tried and failed.
I've also tried IF+VLOOKUP, failed again.
All my effort would either return error N/A or #Value , etc.
Searched through this website but I can't seem to find what I'm looking for. I'm sure it's pretty simple, but I'm sort of a beginner at Excel. So, apologies if this question overlaps. And, HELP.
Try:
=INDEX(B2:F18,MATCH(H17,B2:B18,0),MATCH(I17,B2:F2,0))

Can I use MINIFS or INDEX/MATCH on two non-contiguous ranges...?

Problem is straightforward, but solution is escaping. Hopefully some master here can provide insight.
I have a big data grid with prices. Those prices are ordered by location (rows) and business name (cols). I need to match the location/row by looking at two criteria (location name and a second column). Once the matching row is found (there will always be a match), I need to get the minimum/lowest price from two ranges within the grid.
The last point is the real challenge. Unlike a normal INDEX or MINIFS scenario, the columns I need to MIN aren't contiguous... for example, I need to know what the MIN value is between I4:J1331 and Q4:U1331. It's not an intersection, it's a contiguous set of values across two different arrays.
You're probably saying "hey, why don't you just reorder your table to make them contiguous"... not an option. I have a lot of data, and this spreadsheet is used for a bunch of other stuff. So, I have to work with the format I have, and that means figuring out how to do a lookup/min across multiple non-contiguous ranges. My latest attempt:
=MINIFS(AND($I$4:$J$1331,$K$4:$P$1331),$B$4:$B$1331,$A2,$E$4:$E$1331,$B2)
Didn't work, but it should make it more clear what I'm trying to do. There has GOT to be an easy way to just tell excel "use these two ranges instead of one".
Thanks,
Rick
Figured it out. For anyone else who's interested, there doesn't seem to be any easy way to just "AND" arrays together for a search (Hello MS, backlog please). So, what I did instead was to just create multiple INDEX/MATCH arrays inside of a MIN function and take the result. Like this:
MIN((INDEX/MATCH ARRAY 1),(INDEX/MATCH ARRAY 2))
They both have identical criteria, the only difference is the set of arrays being indexed in each function. That basically gives me this:
MIN((match array),(match array))
And Min can then pull the lowest value from either.
Not as elegant as I'd like... lots of redundant code, but at least it works.
-rt

Better way to Vlookup

I would like to know if there is a better alternative to Vlookup to find matches between two cells (or Python Dfs).
Say I have the below Dfs,
I want my code to check if the values in DF1 was in DF2, If values exactly match OR if the values partially matche return me the value in the DF2.
Just like the matches in 4th column Row 2,3 returned values.
Thanks Amigo!
Well, as you probably suspected already, you have several options. You can easily search for an exact match, like this.
=VLOOKUP(value,data,column,FALSE)
Here is an example.
https://www.excelfunctions.net/vlookup-example-exact-match.html
Or, consider doing a partial match, as such.
=VLOOKUP(value&"*",data,column,FALSE)
Here is an example.
https://exceljet.net/formula/partial-match-with-vlookup
Oh, you can do a fuzzy match as well. Use the AddIn below for this kind of task.
https://www.microsoft.com/en-us/download/details.aspx?id=15011
In Python, it would be done like this.
matches = []
for c in checklist:
if c in words:
matches.append(c)
Obviously, the items in the square brackets are the items in the list.
For Python fuzzy matches, follow the steps outlined in the link below.
https://marcobonzanini.com/2015/02/25/fuzzy-string-matching-in-python/

Excel, using a second index match if first is empty

I was wondering if theres an easy way to setup a formula that is an index match one a sheet of data, and then if there was no match, look somewhere else.
I have new results which I want to look up from, then if not I have historical results to look up from. I dont want to combine the data as I dont want the historical numbers to change any averages in the new results.
I could use two columns each with a different index match and then some IF, OR statements but I'd like to know if theres a way of doing it all in one forumla.
Thanks
MATCH will return an error where a matching value is not found. This can be used to switch to an alternative match attempt, eg:
=IFERROR(INDEX(Sheet1!A:A,MATCH(C1,Sheet1!B:B,0)),INDEX(Sheet2!A:A,MATCH(C1,Sheet2!B:B,0)))

Resources