Hi,
I need to get the value of a column from a different worksheet in the same excel file.
Sheet1
Col1 Col2 CID Cname Col5
Sheet2
ID Name
I need to populate the Cname column in the Sheet1 with the values from Name column in Sheet2 for the matching values in column CID(in Sheet1) and ID (in Sheet2). Attaching a sample excel sheet
Help in writing a macro would be highly appreciated
regards
Nav
Why not use VLOOKUP?
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
could you elaborate how vlookup fits into my requirements
many thanks..
You don't need VBA, use VLOOKUP formulas to match the ID number and place associated data into the column.
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
hi couldnt do it.. i tried different variations..
If possible can up update the excel sheet i attached...
thanks a tonne..!!!
In CName column use this formula in D2 and then copy it down
=VLOOKUP(C2,Sheet2!$A$1:$B$10,2,FALSE)
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Thanks a tonnes it worked!!! You're a star!!!
can it also work if the ID columnin sheet1 and ID column in sheet2 are not sorted. Is it necessary for them to be sorted?
Also, there are multiple instances of same CIDS in sheet1 which makes it go awry
Thanks in advance
Last edited by naveenarora23; 09-08-2008 at 05:12 AM. Reason: incomplete description of problem
There's more help on VLOOKUP here
http://www.excel-it.com/excel_functions.htm
The formula will return the first instance of the ID and using the False statement will not require sorting.
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Thanks a tonne. :-)
u made my day!!! this is excellent forum i will recommend it to all...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks