Vlookup on same column

Giancar

Board Regular
Joined
Nov 29, 2017
Messages
52
Hi everyone,

I have a table similar to the following one, but contains thousands of rows.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Country[/TD]
[TD]ID[/TD]
[/TR]
[TR]
[TD]Brazil[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Belgium[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Russia[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Russia[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]Belgium[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]Brazil[/TD]
[TD]200[/TD]
[/TR]
</tbody>[/TABLE]

Each cell in column A has a Sale ID in Column B, but some of them are empty (in column B). I would need a formula in B1 that vlookup value in column A, returning column B value.
I tried the following:
=VLOOKUP(A2,A:B,2,0)
=VLOOKUP(A:A,A:B,2,0)
and some more, but it gives me error.

The aim of this formula is that I want to fill the first part of column B.

Any help?
Thanks
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You will need to adjust the ranges in the formula, but this works on the sample data you provided.

Select column B. Hit F5. Click 'Special', then select 'Blanks'. Enter the formula, then hold Control and hit Enter.

Code:
=LOOKUP(2,1/SEARCH($A$2:$A$7,A2),$B$2:$B$7)
 
Upvote 0
For that, I had

=VLOOKUP(A1,'worksheetfilepath'!$A$1:$B$numberofrows, 2, FALSE)

Where worksheetfilepath is your source document, and number of rows is however many are in your list.
Although I have only used that when numbers are in the first column, not text.
 
Upvote 0
You will need to adjust the ranges in the formula, but this works on the sample data you provided.

Select column B. Hit F5. Click 'Special', then select 'Blanks'. Enter the formula, then hold Control and hit Enter.

Code:
=LOOKUP(2,1/SEARCH($A$2:$A$7,A2),$B$2:$B$7)

Hi,

I do not understand what do you mean by hit F5 and click special....what kind of window should I open?
Formula looks good, but I can not apply it.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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