Auto Copy Company Name based on company ID

savio

Board Regular
Joined
Sep 3, 2005
Messages
144
Hi all,

I need to automatically copy the company name from sheet 1 to sheet 2 based on company ID.

Any help will be highly appreciated.

Thanks in advanced
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
=IFERROR(VLOOKUP(Company ID,Sheet 1,2,0),"")

this will look up the cell "Company ID" in "Sheet 1" and return what ever is in column 2 .. if it is not found than you will have a blank space. So if sheet 1 has the cmpany ID in column 3 and the company name is in column 1 change the "2" to a "1" .. ect
 
Upvote 0
Hi dnorm,

Thank you for your reply.

In sheet 1 i have the company ID start from column A2 and the company name in column B2 .

My question In which cell/sheet should i post your code?

Thanks
 
Upvote 0
Hi Savio

This formula would go in the cell where you want the company name to appear. In case I did not make it clear enough (sorry if that is the case).

=IFERROR(VLOOKUP(Company ID,Sheet 1,2,0),"")

the IFERROR command should return a blank if no match is made in this case.
VLOOKUP will look for the matching data in another sheet.
Where "Company ID" is that is the cell with the ID number on sheet 2 for you.
"Sheet 1" is the location of your data where the information is - in your case Sheet1!A:A ... as you are only wanting to look in column A
The "2" is the column where the result you are after is (note column A would be 1, B would be 2, C would be 3 ..etc..)
The "0" is the row location, as all your information you wish to reference is on the same row we have entered a 0.

so your formula should look something like:- =IFERROR(VLOOKUP(A2,Sheet1!A:A,2,0)"")

I hope this helps!
 
Upvote 0

Forum statistics

Threads
1,215,518
Messages
6,125,291
Members
449,218
Latest member
Excel Master

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