Master Work
asked on
how can I lookup with two values in Excel
how can I lookup with two values in Excel. Please read sheet 2 from sheet 1 in the attached example.
grid-map-analysis.xlsx
grid-map-analysis.xlsx
There is not a strict 'Lookup' in the file as none of your values for X or Y match in the table.
A close aproximation may be found using the following:
But I am not certain that this will give the correct results.
A close aproximation may be found using the following:
=INDEX(Sheet1!$C$2:$C$2501,MATCH(Sheet2!F11&"|"&Sheet2!E11,Sheet1!$B$2:$B$2501&"|"&Sheet1!$A$2:$A$2501,1))
Press [ctrl]+[shift]+[enter] when putting it in cell G11 and drag down.But I am not certain that this will give the correct results.
The values in sheet 2 are not in sheet 1. Thus this won't work.
If you want to lookup values that actually exist you can use lookup like this :
If you want approximate matches replace the values in sheet 1 with approximation (using round).
Hope it helps.
If you want to lookup values that actually exist you can use lookup like this :
=LOOKUP(2;1/(Sheet1!$A$2:$A$2501=Sheet2!E11)/(Sheet1!$B$2:$B$2501=Sheet2!F11);Sheet1!$C$2:$C42501)
If you want approximate matches replace the values in sheet 1 with approximation (using round).
Hope it helps.
Try this:
=INDEX(Sheet1!$C:$C,(MATCH ($F11,Shee t1!$B:$B,1 )-50+MATCH ($E11,OFFS ET(Sheet1! $A$1,MATCH ($F11,Shee t1!$B:$B,1 )-50,0,50, 1),1)))
I notice that column B values are sorted in ascending order and are repeated 50 times with the same 50 values in column A repeated for each group of values in column B.
Thus, the first MATCH will find the group in column B that meets the largest value that is less than or equal to value y, by deducting 50 we then have the row of the start of that group.
The second MATCH then uses the start and finish of that group in an OFFSET function to find the closest to value x in that group.
The INDEX then uses the group and within group values to locate the value in column C.
For example:
x y
297655 3149555
The MATCH on y value in column B gives row 1201, this is the last row of the group 3149547 (the next group is higher than required value). By deducting 50 we know that this group starts in row 1152.
We then use the OFFSET to create a range for rows 1152 to 1201 and match value x in this group, the closest result is 297648 which is in row 24 (of the group). We now know that the required value in column C is 24 rows after row 1152, row 1175 after allowing for headers.
Result: 2603.171
Hope that helps.
=INDEX(Sheet1!$C:$C,(MATCH
I notice that column B values are sorted in ascending order and are repeated 50 times with the same 50 values in column A repeated for each group of values in column B.
Thus, the first MATCH will find the group in column B that meets the largest value that is less than or equal to value y, by deducting 50 we then have the row of the start of that group.
The second MATCH then uses the start and finish of that group in an OFFSET function to find the closest to value x in that group.
The INDEX then uses the group and within group values to locate the value in column C.
For example:
x y
297655 3149555
The MATCH on y value in column B gives row 1201, this is the last row of the group 3149547 (the next group is higher than required value). By deducting 50 we know that this group starts in row 1152.
We then use the OFFSET to create a range for rows 1152 to 1201 and match value x in this group, the closest result is 297648 which is in row 24 (of the group). We now know that the required value in column C is 24 rows after row 1152, row 1175 after allowing for headers.
Result: 2603.171
Hope that helps.
Would you be averse to re-arranging the data into a matrix format?
If that was OK, the INDEX formula could be simpler as you are only trying to find a column and a row; not a row within a group of rows:
=INDEX(Sheet3!$A$1:$AY$51, MATCH($E20 ,Sheet3!$A $1:$A$51,1 ),MATCH($F 20,Sheet3! $A$1:$AY$1 ,1))
See attached with both options, sheet 3 has the matrix of values.
If that was OK, the INDEX formula could be simpler as you are only trying to find a column and a row; not a row within a group of rows:
=INDEX(Sheet3!$A$1:$AY$51,
See attached with both options, sheet 3 has the matrix of values.
Matrix format would also potentially reduce the file size if that was to be an issue.
The list has over 7500 populated cells whereas the matrix only has 2500 because you don't have the repetition.
The list has over 7500 populated cells whereas the matrix only has 2500 because you don't have the repetition.
ASKER
this is actually the sheet I want to use. I need to add in the NewWells sheet new x and y and lookup the value
Sorry, don't understand the new requirement.
For the x and y values in NewWells sheet, where is the z value coming from, the existing XY list or the OFMGRID?
Will the values from NewWells list get inserted into the XY list?
For the x and y values in NewWells sheet, where is the z value coming from, the existing XY list or the OFMGRID?
Will the values from NewWells list get inserted into the XY list?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Non of your combined value provided in sheet NewWells available, I have added possible matches with two values in yellow highlighted cells with below working formula:
=IFERROR(INDEX(XYandValue!C:C,MATCH(1,(NewWells!D7=XYandValue!A:A)*(NewWells!E7=XYandValue!B:B),0)),"Not Available")
Hope this helps.
You can even customize with Named Range.
Create 3 Named Range:
X_Values:
Create 3 Named Range:
X_Values:
=OFFSET(XYandValue!$A$1, 0, 0, COUNT(IF(XYandValue!$A$1:$A$10000="", "", 1)), 1)
Y_Values:=OFFSET(XYandValue!$B$1, 0, 0, COUNT(IF(XYandValue!$B$1:$B$10000="", "", 1)), 1)
Result_Values:=OFFSET(XYandValue!$C$1, 0, 0, COUNT(IF(XYandValue!$C$1:$C$10000="", "", 1)), 1)
Finally enter below Array Formula confirmed with Cntrl+Shift+Enter and drag down:=IFERROR(INDEX(Result_Value,MATCH(1,(D7=X_Values)*(E7=Y_Values),0)),"Not Available")
Check in attached...
ASKER
Very Good
Glad to be of help.
For completeness and future reference, might be worth explaining why you have chosen mine as your accepted solution.
For completeness and future reference, might be worth explaining why you have chosen mine as your accepted solution.
ASKER
Dear Rob Henson,
Your solution was able to estimate the value within the chosen grid and that is what I want
Regards,
Dallag
Your solution was able to estimate the value within the chosen grid and that is what I want
Regards,
Dallag
pls try as an array formula (CtrlShift+Enter)
Open in new window
Regards