Returning the second, third, etc. value on lookup

sanantonio

Board Regular
Joined
Oct 26, 2021
Messages
124
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I regularly need to return not just the first and last (Which is of course easily returned via xlookup) but everything in between. I found a guide online and am attempting to follow it but can't get it to work as instructed.

The instruction said you should change the final digit in the formula from 2, to whatever entry you are wanting it to return. It works for the first and second found value but refuses to return the third:
1700142428826.png

1700142412022.png



Additionally, in an ideal world I'd get this look up to return values based on 3 criteria. I have a tried and trusted formula for that which I use often (Index/Match) but how I'd incorporate it into finding the 2nd, 3rd etc. I'm not sure and would appreciate some input. The usual formula I use for that is:

Excel Formula:
=INDEX(E3:E8,MATCH(1,(G3=B3:B8)*(G4=C3:C8)*(G5=D3:D8),0))

Thanks in advance all!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Since you have Office 365:

Book1
ABCDE
1ProductsQuantitiesBanana
2Chocolate100First Match200
3Banana200Second Match300
4Orange500Third Match50
5Banana300
6Peach250
7Banana50
8Banana600
Sheet1
Cell Formulas
RangeFormula
E2:E4E2=CHOOSECOLS(TAKE(FILTER(A2:B8,A2:A8=D1),3),2)
Dynamic array formulas.
 
Upvote 0
Solution
How about
Excel Formula:
=filter(E3:E8,(G3=B3:B8)*(G4=C3:C8)*(G5=D3:D8))
 
Upvote 0
Since you have Office 365:

Book1
ABCDE
1ProductsQuantitiesBanana
2Chocolate100First Match200
3Banana200Second Match300
4Orange500Third Match50
5Banana300
6Peach250
7Banana50
8Banana600
Sheet1
Cell Formulas
RangeFormula
E2:E4E2=CHOOSECOLS(TAKE(FILTER(A2:B8,A2:A8=D1),3),2)
Dynamic array formulas.

Hi @Scott Huish thanks for coming back to me.

I get mixed results with your suggestion.

Following your suggestions without locking any cells I get this:

1700651886749.png


If I lock all the cells I get:
1700651906403.png


And then if I lock D1 I get:
1700651921319.png


I presume I'm doing the locking part incorrectly, any advice?
 
Upvote 0
How about
Excel Formula:
=filter(E3:E8,(G3=B3:B8)*(G4=C3:C8)*(G5=D3:D8))

Hi @Fluff

Thanks for coming back to me, this formula references a lot of cells that are blank in my example and returns errors. Not sure what each part is supposed to refer to in my example?
 
Upvote 0
With the formula Scott supplied do not confirm it with Ctrl Shift Enter, just use Enter & it will spill down.
Not sure what you mean about the formula I supplied referencing blank cells, it was based on the Index/match formula you posted to use various criteria.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,173
Members
453,021
Latest member
Justyna P

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