V or Xlookup multiple values in single cell

gmooney

Active Member
Joined
Oct 21, 2004
Messages
254
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a column of data that contains multiple numbers in a single cell that are seperated by using the ALT-Enter option like below.

I want to look up each of these values and compare to another file that has only 1 value per cell in a column. How can I accomplish this and also how would I handle the fact that I could get either no results or up to 3 results back?

301
305
310
815
825
845
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
This one is fun:
MrExcelPlayground20.xlsx
AB
1301 305 310is a silly
2815 825 845fat goose.
3435 436 438
4115 120 125Jamie
5
6
7
8115Jamie
9301is
10305a
11310silly
12815fat
13845goose.
Sheet21
Cell Formulas
RangeFormula
B1:B4B1=LET(a,VALUE(TEXTSPLIT(A1,,CHAR(10))),b,XLOOKUP(a,$A$8:$A$13,$B$8:$B$13,"",0),TEXTJOIN(CHAR(10),FALSE,b))
 
Upvote 0
Solution
This one is fun:
MrExcelPlayground20.xlsx
AB
1301 305 310is a silly
2815 825 845fat goose.
3435 436 438
4115 120 125Jamie
5
6
7
8115Jamie
9301is
10305a
11310silly
12815fat
13845goose.
Sheet21
Cell Formulas
RangeFormula
B1:B4B1=LET(a,VALUE(TEXTSPLIT(A1,,CHAR(10))),b,XLOOKUP(a,$A$8:$A$13,$B$8:$B$13,"",0),TEXTJOIN(CHAR(10),FALSE,b))
Hi there....Thank you...That did what I needed however the number of lines per cell to look up will not always be 3. I have some cells that have up to 24 lines of either 3 or 4 character text.
 
Upvote 0
That did what I needed however the number of lines per cell to look up will not always be 3. I have some cells that have up to 24 lines of either 3 or 4 character text.
In what way does the suggested formula not work in those circumstances?
I have also included a slight variation in case you didn't want the blank lines in the results.

gmooney.xlsm
ABC
13015 305 310is a sillyis a silly
26845goose.goose.
3435 436 438 8888  
4115 120 3015 222 305 310 815 6845Jamie is a silly fat goose.Jamie is a silly fat goose.
5
6
7
8115Jamie
93015is
10305a
11310silly
12815fat
136845goose.
Sheet3
Cell Formulas
RangeFormula
B1:B4B1=LET(a,VALUE(TEXTSPLIT(A1,,CHAR(10))),b,XLOOKUP(a,$A$8:$A$13,$B$8:$B$13,"",0),TEXTJOIN(CHAR(10),FALSE,b))
C1:C4C1=LET(a,VALUE(TEXTSPLIT(A1,,CHAR(10))),b,XLOOKUP(a,$A$8:$A$13,$B$8:$B$13,"",0),TEXTJOIN(CHAR(10),TRUE,b))
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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