Excel Vlookup - multiple lookup values? - excel

is it possible to use something like this in vlookup() ?
=vlookup(or(1,2,3,4), a1:c10, 2)
I want to find the first instance in column A that contains the numbers 1-4

You can't use VLOOKUP for this, but you can do it with the help of MATCH.
Try this (using array formula -> ctrl+shift+enter):
{=INDEX(B1:B10,MIN(IFERROR(MATCH({1;2;3;4},A1:A10,0), FALSE)))}
The idea is to match against 1-4 to get the index, convert errors to non-errors (FALSE), then get the minimum row number. Then that row number is used as an index to the values column.

Related

I have a column of alphanumeric data and would like to sum the values that are one row below the lookup value

I would like to return the sum of all values that are directly below a look up value "Pre173RB" in a single column.
First I used index and match but this is limited to only finding the first value "8".
=INDEX(B:B,MATCH(E1,B:B,0)+1,1)
I then attempted to incorporate the above formula into the repeating sequence below. The formula returned the first value in the column "30". The desired return is "18".
=INDEX(B:B, SMALL(IF(ISNUMBER(MATCH(E$1,B:B,0)+1), MATCH(ROW(B:B), ROW(B:B)), ""),ROWS(A$1:A1)))
I've attempted to use sumif in the above formula as well but errors return.
Any assistance is appreciated. I am probably complicating the formula.
=SUMIFS(B2:B26,B1:B25,E1)
Note that the sum range is offset one row versus the condition range.

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

My index match formula is returning #N/A and I cannot figure out why?

I am trying to use an index match formula to return a value based on two values. However, it is returning #n/a. I have created a simple table with one row and 3 coloumns as a test to try and figure out what is going wrong. Below is a simple table I made for this purpose. I want to return column L based on the criteria from columns J and K.
J K L
123 4 7
Here is the formula I have used.
=INDEX(L3,MATCH(1,(M8=J3)*(N8=K3),0))
I also used ctrl-shft-enter to run the formula but it is giving me an NA value. When I use an index match to return a value based on only one criteria, the formuala works and it returns a 7 but when I try for multiple criteria, the formula fails.
Any help would be greatly appreciated.
Thanks,
G
I think what you need to do is Concatenate the columns of interest then do the match. Try:
=INDEX(L3,MATCH(M8&N8,J3:J6&K3:K6,0))
This should be entered as array formula using Ctrl+Shift+Enter.
What the formula does is:
Concatenate the values being searched in memory.
=INDEX(L3,MATCH(123&4,J3:J6&K3:K6,0))
Then it also concatenates all the values in the columns joined in memory.
=INDEX(L3,MATCH("1234",{"1234";"";"";""},0))
And then the actual matching.

array formula in excel that returns the row number of the maximum value in a multiple-column range

I have a pivot table with format as follows:
I find the highest export quantity in all countries by the formula max(B2:D4) which comes out as 83.
Now I want to find the company name corresponding to this max value i.e. CompanyA in this case.
The actual pivot table has 241 rows and over 40 columns. But the layout is as described.
On Approach would be following formula:
=INDEX($A$1:$A$4,MAX(IF(B2:D4=MAX(B2:D4),ROW(B2:D4)-ROW(A1)+1)))
Entered as a matrix formula with SHift+Ctrl+Enter
This should work for you:
=INDEX(A2:A4,MATCH(MAX(B2:D4),D2:D4,0))
Hope it's what you are looking for!
It would be nice to use a VLOOKUP but this can only find columns to the right of the match, so to go to the left of a match try this solution, which uses the MATCH() and INDEX() functions:
http://www.excel-easy.com/examples/left-lookup.html
Using your example image create 3 new columns (and then if you want combine them all into 1 by aggregating the formulas)
The formula for colum E is just your MAX function
For F it is this: =MATCH(E2,B2:D2,0). The MATCH() function looks for the value contained in cell E2 (which is the max of B2:D2) in the array B2:D2 which is row A of your company values. The trailing ,0 in the function parameters tells the function to look for the first exact match. It thus returns the column where the max value occurred. You can then use the column to look up the names of the companies:
For G it is =INDEX($B$1:$D$1,1,F2)

Resources