MATCH/INDEX from 2 worksheets with a different criteria

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,214
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
2 ws are there
Ws1 “Pr” & ws2 “OP”

I want to MATCH I51:I65 of ws “Pr” with F1259:F1520 of ws “OP” & return ‘lower’ value of G (of ws “OP”) in Y (of ws “Pr) & return ‘upper’ value of G (of ws “OP”) in Z (of ws “Pr)
YOU MAY ADD HELPER COLUMNS/ROWS IF REQUIRED
How to accomplish?
Thanks in advance.
MATCH.xlsx
IYZ
5139800CE277.05291.22
5239900CE230277.78
53
54
5539900CE230277.78
5640000CE196.4275.73
57
58
59
6040000CE196.4275.73
6140100CE165255.73
62
63
6440100CE165255.73
6540200CE135230.8
Pr


MATCH.xlsx
FG
125939400CE470.19
126039400CE514.05
1261
127939500CE431.95
128039500CE444.35
1281
129939600CE354.68
130039600CE375.8
1301
131939700CE320.03
132039700CE332
1321
133939800CE291.22
134039800CE277.05
1341
135939900CE277.78
136039900CE230
1361
137940000CE275.73
138040000CE196.4
1381
139940100CE255.73
140040100CE165
1401
141940200CE230.8
142040200CE135
1421
143940300CE228.13
144040300CE113
1441
145940400CE224.96
146040400CE94.05
1461
147940500CE198.45
148040500CE74.55
1481
149940600CE169.33
150040600CE64.4
1501
151940700CE130.78
152040700CE56.6
OP
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
If your values in sheet OP maintain the same format, meaning that the upper value appears first and the lower value appears second in the list, then how about something like this. Since I did not know exactly where all your rows of data are, I used row 1. This should not be an issue because the formula is looking at the entire column as opposed to a range.

INDEX MATCH 3.xlsm
HIYZAA
139800CE277.05291.22
239900CE230277.78
3  
4  
539900CE230277.78
640000CE196.4275.73
7  
8  
9  
1040000CE196.4275.73
1140100CE165255.73
12  
13  
1440100CE165255.73
1540200CE135230.8
16
17
Pr
Cell Formulas
RangeFormula
Y1:Y15Y1=IFERROR(INDEX(OP!G:G,MATCH(I1,OP!F:F,0)+1),"")
Z1:Z15Z1=IFERROR(INDEX(OP!G:G,MATCH(I1,OP!F:F,0)),"")
 
Upvote 0
@igold
Thanks for your help. Your formula works well.
1 exercise I would like to learn: your quote "I used row 1...", In Your above 2 formulas, only the formula in Y1 has "1" & there is no "1" in your Z1 formula. Why So?
IF I have to replicate your formula from row 1259, what & where the required change/(s) should I have to make in your 2 formulas?
 
Last edited:
Upvote 0
You're welcome, I was happy to help. Thanks for the feedback!
 
Upvote 0
Can you please explain me the 'edited' comments of thread #3?
 
Upvote 0
@igold
Will these 2 formulas wok properly or it may lead to some 'unknown' errors?
Y51
Excel Formula:
=MIN(OP!$G$1259:$G$1520*(OP!$F$1259:$F$1520=Pr!I51))
Z51=
Excel Formula:
MAX(OP!$G$1259:$G$1520*(OP!$F$1259:$F$1520=Pr!I51))
 
Upvote 0
The formula looks down the entire columns of OP (columns G and F) so you can use this formula anywhere as long as wherever you place the "Lookup Value" in the "Match" portion of the formula corresponds to the row in which the formula is placed (I hope that makes sense).

For use in Row 1259 your formulas would be:
Column Y: =IFERROR(INDEX(OP!G:G,MATCH(I1259,OP!F:F,0)+1),"")
Column Z: =IFERROR(INDEX(OP!G:G,MATCH(I1259,OP!F:F,0)),"")

The reason for the "+1" in the formula in Column Y is that the Index returns the first instance of the LookUp Value. Since there are two lookup values, I had to add 1 to the column to return the second instance.
 
Upvote 0
Solution
@igold
Will these 2 formulas wok properly or it may lead to some 'unknown' errors?
Y51
Excel Formula:
=MIN(OP!$G$1259:$G$1520*(OP!$F$1259:$F$1520=Pr!I51))
Z51=
Excel Formula:
MAX(OP!$G$1259:$G$1520*(OP!$F$1259:$F$1520=Pr!I51))
If it works, it works. There should not be any unknown errors in formulas...
 
Upvote 0
For use in Row 1259 your formulas would be:
Column Y: =IFERROR(INDEX(OP!G:G,MATCH(I1259,OP!F:F,0)+1),"")
Column Z: =IFERROR(INDEX(OP!G:G,MATCH(I1259,OP!F:F,0)),"")
Thanks for your answer...I had replicated wrongly, now all good. Many thanks.

Excel Formula:
=IFERROR(INDEX(OP!G:G,MATCH(I1259,OP!F:F,0)+1),"")

Excel Formula:
=IFERROR(INDEX(OP!G:G,MATCH(I1259,OP!F:F,0)),"")
 
Upvote 0
Great, I am glad you got it squared away. I hope my explanation was understandable.
 
Upvote 0

Forum statistics

Threads
1,215,504
Messages
6,125,185
Members
449,213
Latest member
Kirbito

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top