How to do return multiple lookups within 1 cell

Dave87

Board Regular
Joined
Apr 22, 2020
Messages
107
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

I have a problem with this and cant think of anyway to do this except manually and i have circa 5000 rows. (Apologies for not using XL2BB but work has blocked its install, also this is an example file, real document has 5000 or so rows in sheet 1 and about 3500 in sheet2)

Sheet 1
This contains a range (can convert to table if required) which has multiple Ref's within individual cells, i'd like to bring the title and date from sheet2 to to the corresponding cells in columns B & C. The average number of "Refs" in a cell is generally less than 10 (however sometimes 0) and I have 3 cells with 14, 39, and 84 Refs

In Sheet 1 I've manually populated cells B2:C3, how can I formula/Macro this?

Sheet 1 (there is a space between the last number and the next Ref i.e. in cell A3 the text is REF-00008(space) ALT+Enter REF-00007. There is no space after the 7.
Ref
Title
Date
REF-00001
Anna Karenina by Leo Tolstoy. ..2/03/1988
REF-00008
REF-00007
In Search of Lost Time by Marcel Proust
The Great Gatsby by F. ..
2/04/1940
23/03/1991
REF-00002
REF-00006
REF-00008
REF-00005
REF-00006
REF-00007


SHEET2
REFTITLEDATE
REF-00001
Anna Karenina by Leo Tolstoy. ..
2-Mar-88
REF-00002
Madame Bovary by Gustav Flaubert. ..
5-Sep-69
REF-00003
War and Peace by Leo Tolstoy. ..
13-Jul-88
REF-00004Lolita by Vladimir Nabokov. ..
6-Sep-59
REF-00005
The Adventures of Huckleberry Finn by Mark Twain. ..
7-Nov-68
REF-00006
Hamlet by William Shakespeare. ..
5-Oct-99
REF-00007
The Great Gatsby by F. ..
23-Mar-91
REF-00008
In Search of Lost Time by Marcel Proust
2-Apr-40
 

Attachments

  • Sheet1.PNG
    Sheet1.PNG
    35.6 KB · Views: 17
  • Sheet2.PNG
    Sheet2.PNG
    32.9 KB · Views: 15

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I used Vlookup to lookup title and date for Sheet 1.

I named Sheet 2 as Table2.

This Vlookup only works for rows with one entry, but it won't work for a merged field.

Maybe someone can write a Macro to resolve this.

RefTitleDate
REF-00001Anna karenina by Leo Tolstoy
3/2/1988​
REF-00005The Adventures of Hickleberry Finn by mark Twain
11/7/1968​
REF-00002Mdame bovary by Gustav Flaubert
9/5/1969​
REF-00004Lolita by Vladimir nabokov
9/6/1959​
REF-00003War and Peace by Leo Tolstoy
7/13/1988​
REF-00005
REF-00002
#N/A​
#N/A​
=VLOOKUP($A2,Table2,2,0)=VLOOKUP($A2,Table2,3,0)
VLOOKUP IN B2 & C2=VLOOKUP($A2,Table2,2,0)=VLOOKUP($A2,Table2,3,0)



 
Upvote 0
Does your version of Excel 365 have the FILTER function? If so, try these, copied down

Cell Formulas
RangeFormula
B2:B6B2=TEXTJOIN(CHAR(10),1,FILTER(Sheet2!B$2:B$9,ISNUMBER(FIND(Sheet2!$A$2:$A$9,$A2))))
C2:C6C2=TEXTJOIN(CHAR(10),1,TEXT(FILTER(Sheet2!C$2:C$9,ISNUMBER(FIND(Sheet2!$A$2:$A$9,$A2))),"d/mm/yyyy"))


Dave87 2020-05-31 1.xlsm
ABC
1REFTITLEDATE
2REF-00001Anna Karenina by Leo Tolstoy. ..2-Mar-88
3REF-00002Madame Bovary by Gustav Flaubert. ..5-Sep-69
4REF-00003War and Peace by Leo Tolstoy. ..13-Jul-88
5REF-00004Lolita by Vladimir Nabokov. ..6-Sep-59
6REF-00005The Adventures of Huckleberry Finn by Mark Twain. ..7-Nov-68
7REF-00006Hamlet by William Shakespeare. ..5-Oct-99
8REF-00007The Great Gatsby by F. ..23-Mar-91
9REF-00008In Search of Lost Time by Marcel Proust2-Apr-40
Sheet2
 
Upvote 0
Solution
Peter, you sir, are a genius! Thank you very much for your help
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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