Offsetting the final result in a two column search.

Donkson

New Member
Joined
Dec 28, 2010
Messages
14
Hi, not sure if this particular issue can be solved or not. I've looked around and seen close to the same problem but not quite.

applebanana12
carrotorange34
bananacarrot56
grapeorange78
bananagrape912
orangeapple1320


So for the above table example, what I need to be able to do is lookup a fruit, and have it return the last occurrence two cells to the right.

For example, looking up orange will return 13. Apple will return 20, grape 12 and so on.

Would greatly appreciate any assistance with this.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
If that data range you posted was in the range A1:D6, this formula would return the result you want:
Excel Formula:
=VLOOKUP("orange",A1:C6,3,0)

Is that what you are looking for?
 
Upvote 0
Nope it’s not that simple because that returns the first value, and the corresponding result isn’t always the third column.

If the bottom result is in column A, I need it to return column C. If it’s column B I need it to return column D.
 
Upvote 0
Try

Pasta1
ABCDEFGH
1FruitFruitValue1Value2FruitRow of Last OccurenceResult
2applebanana12apple620
3carrotorange34banana59
4bananacarrot56carrot36
5grapeorange78grape512
6bananagrape912orange613
7orangeapple1320
8
Plan3
Cell Formulas
RangeFormula
G2:G6G2=AGGREGATE(14,6,(ROW(A$2:B$7)-ROW(A$2)+1)/(A$2:B$7=F2),1)
H2:H6H2=INDEX(C$2:D$7,G2,MATCH(F2,INDEX(A$2:B$7,G2,0),0))


M.
 
Upvote 0
Hi,

Without helper column, I came up with this:

Book3.xlsx
ABCDEFG
1applebanana12orange13
2carrotorange34apple20
3bananacarrot56grape12
4grapeorange78
5bananagrape912
6orangeapple1320
Sheet940
Cell Formulas
RangeFormula
G1:G3G1=LOOKUP(2,1/SEARCH(F1,A$1:A$6&B$1:B$6),IF(LOOKUP(2,1/(A$1:A$6=F1),ROW(A$1:A$6))>LOOKUP(2,1/(B$1:B$6=F1),ROW(B$1:B$6)),C$1:C$6,D$1:D$6))
 
Upvote 0
With A1:B6 is fruit, C1:D6 is value; F1 is lookup fruit
Code:
=INDEX($A$1:$D$6,AGGREGATE(14,6,ROW($A$1:$B$6)/($A$1:$B$6=F1),1),MATCH(F1,INDEX($A$1:$D$6,AGGREGATE(14,6,ROW($A$1:$B$6)/($A$1:$B$6=F1),1),),0)+2)

Capture.JPG
 
Upvote 0
Without helper column

I used a helper column just to simplify the formulas - not strictly necessary. It's possible to replace all the instances of G2 in H2 formula by the formula in G2.

M.
 
Upvote 0
I used a helper column just to simplify the formulas - not strictly necessary. It's possible to replace all the instances of G2 in H2 formula by the formula in G2.

M.

I absolutely know that Marcelo, I was also thinking of a helper column, but since you already provided a solution with such, I put together what I posted, it's not the prettiest, but hope it works also.
 
Upvote 0
You're welcome, glad we can help.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

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