Lookup Commands to find 2nd (or 3rd) instance

cob98tp

Board Regular
Joined
Nov 18, 2004
Messages
146
Hi All,

I have a list of data stored horizontally across a sheet, and am using HLOOKUP to find data - which all works ok.

However the problem I have is that there may be more thaan 1 match, but I can only ever return the first entry. Is there anyway of changing this to return the 2nd or 3rd entry as well, in cases where the match criteria occurs more than once?

Many Thanks
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Hi All,

I have a list of data stored horizontally across a sheet, and am using HLOOKUP to find data - which all works ok.

However the problem I have is that there may be more thaan 1 match, but I can only ever return the first entry. Is there anyway of changing this to return the 2nd or 3rd entry as well, in cases where the match criteria occurs more than once?

Many Thanks

Care to post your working formula?
 

cob98tp

Board Regular
Joined
Nov 18, 2004
Messages
146
Ok, My formula is a little complicated as I am using an indirect to look at the right row..

=HLOOKUP(E10,INDIRECT("'DiaryData'!$D$"&(A3*8)-6&":$IV$"&(A3*8)),6,0)

A3 contains a number which corresponds to a date. (A3*8)-6 therefore is the row number for the date I'm looking for. Each entry in the Datalist Has 8 rows of info and looks a bit like this...

Date 1 Name
Info 1
Info 2

Info 8
Date 2 Name
Info 1

and so on, with the data stored in the columns next to these headings. The HLOOKUP looks for the correct Name and returns the value in the 'Info 6' row at the moment.

What I want is to have another formula that will look for the 2nd and 3rd instances (if they exist) of the agent name, and display Info 6 again.

Hopefully that is a bit clearer... Many thanks :)
 

Forum statistics

Threads
1,181,722
Messages
5,931,673
Members
436,798
Latest member
spprtpplcm

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
Top