You are here:

Excel/Index and Match Error, is this possible?

Advertisement


Question
Hi tom,
I have a spreadsheet which has a table with multiple values in it. i.e. columns 1 to 3 have different numbers in them depending on user input and choice (eg. col1 m3/hr, col2, kWGross, col3 kWNet)
the other 7 columns have the reference data with a header row, this contains numbers.
what I want to do is be able to index and match a column and row within the table dependant on the 2 values the user inputs. e.g. gas rate and pipe diameter.

I have tried to use the following formula (note this is a non working formula coming up with n/a error all the way through:=)

All data is on one sheet at the moment until I can get the formula working.

User entered data is in cells n5 and n6

=index($A4:$j50, match($n5,$c4:j50,-1), match($n6,$d4:j4,0))

The problem I think is that the first match criteria has multiple possibilities as the data is never likely to be an exact match, also there are multiple numbers that are greater (hence why I used the -1 suffix in the match). Is excel getting confused because there are lots of numbers larger than what the user enters or am I missing something?

Is there any way to get the match statement to take the first number that is higher than the entered value? Is this even possible?

All help very gratefully received.

Answer
Lee,

first:

>Is there any way to get the match statement to take the first number that is higher than the entered value?

from a general perspective, if the data is sorted descending for this column and you use the -1 as the third argument to match, then it will give you the next higher number

For the formula You show have a couple of problems.

Match works against a single column or single row.  You first match is against multiple columns and multiple rows.    

If we assume you want to find the row with the first Match and the column with the second, then you would need to sort your table on descending on the column you want to use to find the row.  Assume that is column C.


then

=index($A4:$j50, match($n5,$c$4:$C$50,-1), match($n6,$A$4:$J$4,0))

Note that for the second match, I start in column A instead of column D.  since you are looking for an exact match, I would guess that would not be a problem.  If it is  you could do

match($n6,$D$4:$J$4,0)+3

hopefully this answers the question.  If not, you can email me the worksheet and I can take a look.  twogilvy@msn.com

--
Regards,
Tom Ogilvy  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Tom Ogilvy

Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2016 About.com. All rights reserved.