Some Sort Of VLookup/Match Formula

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,748
Office Version
  1. 365
Platform
  1. Windows
I have sheet 1 as below. What I need is similar to a VLookup where on sheet 2 it will give me whats in column B on sheet 1 when the corresponding numbers in column A are found. Problem is VLookup only returns one result for each number.

Sheet 1

NumberNumber1
M14307100294003M279
M14307100294003M280
M14307100294003M281
M14307100294003M282
M14307100294003M283

Sheet 2 Using VLookup

NumberNumber1
M14307100294003M279
M14307100294003M279
M14307100294003M279
M14307100294003M279
M14307100294003M279

Obviously on sheet 2 I would like the same result that is on sheet 1. There will be 10s of 1000s of rows and any different amount of matching numbers in column A.
Thanks.
 
You need to reference the sheet(s) where the data is located for this to happen. Look at how it happens in regular Vlookup and adapt.

Sorry I am lost! And you say select range but I will be using on different files and different amount of rows
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Maybe something like...

Pasta2
AB
1NumberNumber1
2M14307100294003M279
3M14307100294003M280
4M14307100294003M281
5M14307100294003M282
6M14307100294003M283
Sheet2
Cell Formulas
RangeFormula
B2:B6B2=INDEX(Sheet1!$B$2:$B$1000,AGGREGATE(15,6,(ROW(Sheet1!$B$2:$B$1000)-ROW(Sheet1!B$2)+1)/(Sheet1!A$2:A$1000=A2),COUNTIF(A$2:A2,A2)))


Hope this helps

M.
 
Upvote 0
Sorry I am lost!

Maybe something like...

Pasta2
AB
1NumberNumber1
2M14307100294003M279
3M14307100294003M280
4M14307100294003M281
5M14307100294003M282
6M14307100294003M283
Sheet2
Cell Formulas
RangeFormula
B2:B6B2=INDEX(Sheet1!$B$2:$B$1000,AGGREGATE(15,6,(ROW(Sheet1!$B$2:$B$1000)-ROW(Sheet1!B$2)+1)/(Sheet1!A$2:A$1000=A2),COUNTIF(A$2:A2,A2)))


Hope this helps

M.
Thanks that seems to be better. What if I want to put the formula in column U on sheet 2 and the column A data on sheet 1 is in column K on sheet 2? Sorry I thought it would be easy to adapt once I got formula but its confusing me.
 
Upvote 0
I did not understand...
Sheet1
Where exactly are your data on Sheet1? Columns A and B?
Sheet2
In which column are the values to be searched?
Do you want the formula in column U?

M.
 
Upvote 0
I did not understand...
Sheet1
Where exactly are your data on Sheet1? Columns A and B?
Sheet2
In which column are the values to be searched?
Do you want the formula in column U?

M.
Sorry I have confused myself and got it around the wrong way. Columns A and B are actually on sheet 2 and the result should be on sheet 1. So sorry. So in column A and B on sheet 2 you have as below.

M10501300000098M279
M10501300000098M280
M10501300000098M281
M10501300000098M282
M10501300000098M283
M10501300000098M284
M10501300000100M285
M10501300000100M286
M10501300000100M287
M10501300000100M288
M10501300000100M289
M10501300000100M290
M10501300000101M291
M10501300000101M292
M10501300000101M293
M10501300000101M294
M10501300000101M295
M10501300000101M296

This is sheet 1

Column KColumn U
M10501300000098
M10501300000098
M10501300000098
M10501300000098
M10501300000098
M10501300000098
M10501300000100
M10501300000100
M10501300000100
M10501300000100
M10501300000100
M10501300000100
M10501300000101
M10501300000101
M10501300000101
M10501300000101
M10501300000101
M10501300000101

So on sheet 1 I need the result in column U.
 
Upvote 0
Also as mentioned before I will use on different files with different amounts of rows. Rather than a range in the formula can I not just put in row 2 and fire down?
 
Upvote 0
Try

Pasta2
KLMNOPQRSTU
1NumberNumber1
2M10501300000098M279
3M10501300000098M280
4M10501300000098M281
5M10501300000098M282
6M10501300000098M283
7M10501300000098M284
8M10501300000100M285
9M10501300000100M286
10M10501300000100M287
11M10501300000100M288
12M10501300000100M289
13M10501300000100M290
14M10501300000101M291
15M10501300000101M292
16M10501300000101M293
17M10501300000101M294
18M10501300000101M295
19M10501300000101M296
Sheet1
Cell Formulas
RangeFormula
U2:U19U2=INDEX(Sheet2!B$2:B$1000,AGGREGATE(15,6,(ROW(Sheet2!B$2:B$1000)-ROW(Sheet2!B$2)+1)/(Sheet2!A$2:A$100=K2),COUNTIF(K$2:K2,K2)))


M.
 
Upvote 0
Try

Pasta2
KLMNOPQRSTU
1NumberNumber1
2M10501300000098M279
3M10501300000098M280
4M10501300000098M281
5M10501300000098M282
6M10501300000098M283
7M10501300000098M284
8M10501300000100M285
9M10501300000100M286
10M10501300000100M287
11M10501300000100M288
12M10501300000100M289
13M10501300000100M290
14M10501300000101M291
15M10501300000101M292
16M10501300000101M293
17M10501300000101M294
18M10501300000101M295
19M10501300000101M296
Sheet1
Cell Formulas
RangeFormula
U2:U19U2=INDEX(Sheet2!B$2:B$1000,AGGREGATE(15,6,(ROW(Sheet2!B$2:B$1000)-ROW(Sheet2!B$2)+1)/(Sheet2!A$2:A$100=K2),COUNTIF(K$2:K2,K2)))


M.
I just get a result of #NUM! is the file I am using on too big?
 
Upvote 0
With a bit of fiddling I got it to work. Will I have to change range on every file I use it on? And can it be made in to a UDF please?
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,887
Members
449,057
Latest member
Moo4247

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