Index match match 2 columns - excel-formula

I’m having difficulty with an index match match formula which I thought would be quite easy to achieve
I have an array C1:M67 in row one I want to find the value stated in A2 Momentum then the value in B2 MOCHA in the corresponding column. Then return the value in the 2 adjacent cells in the example below I want to return the value KM98 and KM98/UK/MM/02
If I were to change the value in A2 to Mid-Range I would want to return KM93 and M98/UK/02/MRANGE
Many thanks for you help in advance

Use an INDEX/MATCH inside the VLOOKUP:
=VLOOKUP($B$2,INDEX($C:$M,0,MATCH($A$2,$C$1:$M$1,0)):INDEX($C:$M,0,MATCH($A$2,$C$1:$M$1,0)+2),2,FALSE)
This will return the sku. For the Code change the ,2, to ,3,

Related

Trouble with Index Matching two rows and one column value

I am attempting to Index and Match and find the green value labeled in my table below based on the criteria in the yellow cells. Any idea how to go about this, here is my current formula:
INDEX($A$2:$F$31, MATCH($H$3,$B$2:$B$31,0), MATCH($H$4, $C$2:$C$31,0))
It keeps returning the "Type" and not the "Cats" value I would like to have, 0.1518. Would Vlookup + Match be easier? Any help would be greatly appreciated.
Basically, I am trying to match two row variables (City and Type) with the column variable (cats) to get the value. However, if I use vlookup then maybe I can just say go to the cat column instead of matching it with another cell.
Try this formula:
=INDEX(E2:E31,MATCH(1,INDEX((H3=B2:B31)*(H4=C2:C31),0,1),0))
Based on the non-array version of the formula found here: https://exceljet.net/formula/index-and-match-with-multiple-criteria

Excel VBA/Formula to find a cell that includes search term?

I was not sure how to really create the question...
But the problem I am having is this: I have a list (in rows) that relate to a regulatory document, and after trying to create some sort of for loop or elaborate VLookUp/Index formula, I'm requesting help.
For example:
Now I want to use the rows to find the corresponding section in the document. I've already extracted and formatted the compliance document so it is in excel format.
So what I really need is this: a formula or VBA script that can
1. take the compliance number (for example 1A-1 which exist in Cell A3) and go find a cell (in single column D) that has JUST 1A-1, not 1A-1.1, not 1A-1.1.2, etc. and return it to the adjacent cell to 1A-1, for example.
Many thanks ahead of time... I am so lost!! :/
VLOOKUP vs INDEX/MATCH
You can do the 'lookup' two ways (that I'm aware of):
Using VLOOKUP:
The B3 cell contains your formula
=IF(ISERROR(VLOOKUP(A3,C:D,2,FALSE)),"",VLOOKUP(A3,C:D,2,FALSE))
where 'FALSE' is indicating there has to be an exact match and the data doesn't have to be sorted.
Using INDEX with MATCH:
The F3 cell contains the Index/Match formula
=IF(ISERROR(MATCH(A3,C:C,0)),"",INDEX(D:D,MATCH(A3,C:C,0)))
where '0' is indicating there has to be an exact match and the data doesn't have to be sorted.
INDEX/MATCH preferable!?
The MATCH function finds the position (row number if whole column is used) of the found match. This way (there's another) of using the INDEX function uses exactly this found match to return a cell's value in that position (row) in ANY specified column range (column). So they are the ideal combination.
With the VLOOKUP function you have to additionally specify the column index (range_lookup) of a range which could get complicated when the columns aren't adjacent as in this case. Most importantly, the function doesn't work if the lookup data is to the right of the match data.
VLOOKUP NOT WORKING! INDEX/MATCH STILL WORKING!
try this formula
The formula in cells
B2: =INDEX(E:E,MATCH(A2,F:F,0))
C2: =INDEX(G:G,MATCH(A2,F:F,0))
MATCH(A2,F:F,0) is finding Cell A2 in column F (0 means it will find
exact match) and will return the first row number when it would find that
INDEX(E:E,MATCH(A2,F:F,0)) will return contents of column E where row number is returned by the Match formula

How to combine: INDEX + MATCH + ?VLOOKUP?

I'm having an issue with INDEX + MATCH combination:
=INDEX(ALL!$C$1:$I$1,MATCH(TRUE,ALL!C2:I2<>0,0))
At the moment the aforementioned formula does this job to an extent, where if it finds <>0 value in a row it will return header from this specific column. The issue is that the ROW (as above C2:I2) needs to be specified.
I need to vlookup values in the column "A" in sheet "ALL" and based on that, look at corresponding rows between C:I and if the value in that specific row is <>0 then return heading value.
So, in green I would need a formula to pick up numbers from "Data Source" headings, based on value 1 or any value <>0. I'm guessing it all leads somehow to some sort of "vlookup" hybrid.
Any ideas how to combine vlookup in it?
Thanks
If there can only be one '1' per row, I was thinking of this
=SUMIF(INDEX(B:E,MATCH(G2,A:A,0),0),">0",$B$1:$E$1)
Otherwise if there can be more than one '1'
=INDEX($B$1:$E$1,MATCH(TRUE,INDEX(B:E,MATCH(G2,A:A,0),0)>0,0))
to match the first value greater than zero, in this case entered as an array formula.
A simple =SUMIF() formula will do, no other convoluted INDEX() and MATCH() nested formulas required.
Let's presume we have a data-table that starts at B2 and end at
F6, like this:
So now, to comprehend the solution, here's the syntax of SUMIF() formula (Function):
=SUMIF( range, criteria, [sum_range] )
So, what we want to do is:
go over the range of C3:F3 (and each other respective row)
the criteria to when to sum, is when this range contains 1
and we want to sum_range (sum up) fixed array of numbers, so $C$2:$F$2
So the result is (for row 3):
=SUMIF(C3:F3,1,$C$2:$F$2)
and we drag the formula down, producing expected result:
PS: I think this illustrates the point very well, as to why it's important to declare not only what your formula is doing but also, what you're trying to as in whole as there often is a better (easier) way to implement something, that you might not have thought of.
In other words, follow the Minimal, Complete and Verifiable Example

Index-Match with Vertical & Horizontal criteria

I am certain that the below index match with multiple criteria should work but for some reason it isn't. A few things about the data in B1:H1 and K1, they are dynamic values, that is, they aren't "dates" so to speak. B1 has a value of =TODAY()+2-WEEKDAY(TODAY()) and K1 has a value of =TODAY().
I can't convert it to a table as I need the headers to be dynamic.
Please help, thanks.
Looks like a vlookup + a match works. If you guys figure out why the index match works on atable and let me know that would be great!
=VLOOKUP(K2, $A$1:$H$15, MATCH($K$1, $A$1:$H$1,0), FALSE)
Try one match to column A and another completely separate match to row 1. In other words, one match for the row number and another for the column number.,
=index(a$1:h$15, match(k2, a:a, 0), match(k$1, $1:$1, 0))
Fill down for the other row-by-column matches.

Return smallest unique value that meets criteria

I need a formula to return the smallest unique value that meets a specific criteria, to the Nth term. Please look at image:
Goal is to have a formula in cells D2:G31 that will return the values of B2:B31 in order of smallest to largest that contain the value in D1:G1.
For example cell D2 would return 3 because it is the smallest value in the "1's" group. Cell D3 would return 12, Cell E2 would return 1, Etc...
I have tried using the code below but it just returns TRUE, I am not sure how to achieve my goal, but maybe this will help your understanding.
=AND(VLOOKUP(1,A2:B31,2),SMALL(B2:B31,1))
The AGGREGATE function provides a great method of solving this type of problem without needing array formulas. I mocked up a similar problem and used the following formula in cell E2 (dragging across and down)
=AGGREGATE(15,6,$B$1:$B$12/($A$1:$A$12=E$1),ROW(1:1))
See this answer from Jeeped for a better explanation of how it works and also an example with multiple criteria.
This array formula (click Ctrl + Shift + Enter together) should work for you.
=IFERROR(SMALL(IF($A$2:$A$31=D$1,$B$2:$B$31,""),ROW()-ROW(D$1)),"")

Resources