Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Excel Match Result as Column Selection

I have a MATCH expression that returns the valid row number.

I now need to combine this result with a known Column identifier to return the results of that cell.

So, if something on A50 = "apple", then I can get the contents of cell D50.

I looked at INDIRECT and INDEX, but I'm not seeing how it can help.

Answer:

=INDEX('SHEET1'!A:D,MATCH(SHEET2!A2,'SHEET1'!B:B,0),4)

I got INDEX to work. It took some more reading up on it.

'SHEET1'!A:D is the range for INDEX to work with.

MATCH(SHEET2!A2,'SHEET1'!B:B,0) is pulling the row based upon my MATCH criteria.

4 is the column to return the cell contents from using the row number from the MATCH above.

Hopefully this will help someone else understand how to use INDEX.

like image 790
Shawn Avatar asked Apr 22 '11 16:04

Shawn


People also ask

Does Match work with columns?

MATCH is used twice: once for the rows and once for the columns. In this example, the return range in the Index function involves multiple columns and the MATCH function instructs the formula to move down a certain number of rows and move over a number of columns across the sheet to retrieve the desired value.

Can you use INDEX match for columns?

The INDEX MATCH function is one of Excel's most powerful features. The older brother of the much-used VLOOKUP , INDEX MATCH allows you to look up values in a table based off of other rows and columns. And, unlike VLOOKUP , it can be used on rows, columns, or both at the same time.

How do I match data from one column to another column in Excel?

Navigate to the "Home" option and select duplicate values in the toolbar. Next, navigate to Conditional Formatting in Excel Option. A new window will appear on the screen with options to select "Duplicate" and "Unique" values. You can compare the two columns with matching values or unique values.


3 Answers

=INDEX('SHEET1'!A:D,MATCH(SHEET2!A2,'SHEET1'!B:B,0),4)

I got INDEX to work. Took some more reading up on it.

'SHEET1'!A:D is the range for INDEX to work with. MATCH(SHEET2!A2,'SHEET1'!B:B,0) is pulling the row based upon my MATCH criteria. 4 is the COLUMN to return the cell contents from using the ROW number from the MATCH above.

However, the other options given were very helpful as well.

like image 60
Shawn Avatar answered Oct 14 '22 22:10

Shawn


Give VLOOKUP a try. For example,

=VLOOKUP("apple",$A$1:$D$100,4,false)

It's a very useful function.

like image 43
Jubbles Avatar answered Oct 14 '22 21:10

Jubbles


INDIRECT allows you to refer to any arbitrary cell in the sheet by specifying its location using a dynamic value. In your case, you'll want to do something like this:

=INDIRECT("D"&MATCH(<your match here>))

That will return the value of the cell D50 in the example you've given. The Excel documentation says it returns a "reference" to that cell, but in reality it's immediately evaluated to the cell's value.

The main benefit of this approach over VLOOKUP is that INDIRECT will refer to any arbitrary cell, whereas VLOOKUP requires a known data range and a matching value. For example, if your MATCH criteria references another sheet from the data you want to pull, your best option is INDIRECT.

like image 2
Karelzarath Avatar answered Oct 14 '22 22:10

Karelzarath