 # IF conditional with INDEX and MATCH

I have an array of data that is 3 columns and 27 rows. I currently am using only INDEX and MATCH to type in a value and retrieve the other two correlated column values, however this only works if the value entered has an exact match in the designated search column. If the value does not have an exact match, I need the code to interpolate the values of the other two columns using the formula y2 = ((( x2 - x1 ) ( y3 - y1 )) / ( x3 - x1 )) + y1. Any help is greatly appreciated!

currently am using =INDEX(B10:E36,MATCH(H2,E10:E36,0),1) to enter a value in cell H2 and get outputs from the same row but different columns.

2 Replies

# Re: IF conditional with INDEX and MATCH

A little hard to visualize what result you're looking for but would something like this work?
=IF(B2<>C2,([put formula here]),XLOOKUP(H2,A:A,B:C))
It's saying if B2 an C2 are different, then run your formula, otherwise return the two values in B and C from the lookup value set in H2. My columns are different then yours but the logic should be the same. XLookup is a great replacement for index and match.

# Re: IF conditional with INDEX and MATCH

I only see HLOOKUP or VLOOKUP and neither would be suitable as they only go from left to right when going through a table or array. The data isn't formatted in a way to easily use lookups due to this.

I included a picture of how I need to input and output data. I enter a value into the blue box and get the correlated values in the white boxes. however if I enter 15, for example, but there is only data correlated to 13 and 17, I need to use those as well as the as well as the correlated data from 'RAW' to interpolate the 'RAW' value at 15, and then do the same for 'ADC'. the following image shows how I'm trying to proceed with an IF conditional; basically I'm trying to code 'If there is an exact value match within the column, return the correlated value for 'RAW', if there's not an exact match, i need to use the two data points above and below to interpolate the 'RAW' value and return that.

Then I will use that same code only returning the 'ADC' values

hope this clarifies