Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default vlookup function

Hi there

I have a template that I use for various sets of data that I receive from
time to time.

The data has a unique number, to which I have to enter in the associated
details manually.

The unique number however may feature many times in the data.

The template is set up to cope with 1000 records. I use the vLookup
function to populate the rows of data, according to the unique number.

I am sure that someone would be able to advise me on how I could create a
macro or VBA to do this, instead of just using the function.

i.e.

UNIQUE RECORDS

Number Name Address
0001 Eddie 2 Smith Street
0002 Oliver 34 Jones Street

Would need to populate:

Number Name Address
0002
0002
0001
0002
0001

Many thanks for taking the time to read this and for any suggestions that
may be forthcoming!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default vlookup function

Try this:

In the following, VLData is your lookup table (3 Columns as per your Unique
Records).

Assuming the records to be populated have data in coums A, B and C starting
in the second row then:

Put the following in B2

IF(ISERROR(VLOOKUP(A2,VLData,2)),"",VLOOKUP(A2,VLD ata,2))

and this in C2

=IF(ISERROR(VLOOKUP(A2,VLData,3)),"",VLOOKUP(A2,VL Data,3))

Drag both columns down for your 1000 records.

When you enter a Number (in Column A) the name and address will be filled in
or left blank if there is no entry in VLData..


HTH

"Blobbies" wrote:

Hi there

I have a template that I use for various sets of data that I receive from
time to time.

The data has a unique number, to which I have to enter in the associated
details manually.

The unique number however may feature many times in the data.

The template is set up to cope with 1000 records. I use the vLookup
function to populate the rows of data, according to the unique number.

I am sure that someone would be able to advise me on how I could create a
macro or VBA to do this, instead of just using the function.

i.e.

UNIQUE RECORDS

Number Name Address
0001 Eddie 2 Smith Street
0002 Oliver 34 Jones Street

Would need to populate:

Number Name Address
0002
0002
0001
0002
0001

Many thanks for taking the time to read this and for any suggestions that
may be forthcoming!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default vlookup function

Sub MyLookup()
Dim ws1 as Worksheet, ws2 as Worksheet
Dim rng1 as Range, rng2 as Range
set ws1 = worksheets("Uniques")
set ws2 = worksheets("Duplicates")
set rng1 = ws1.Range(ws1.Cells(2,1),ws1.Cells(2,1).End(xldown ))
set rng2 = ws2.Range(ws2.Cells(2,1),ws2.Cells(2,1).End(xldown ))
rng2.offset(0,1).Formula = "=Vlookup(A2," & rng1.Resize(,3).Address _
(External:=True) & ",2,False)"
rng2.offset(0,2).Formula = "=Vlookup(A2," & rng1.Resize(,3).Address _
(External:=True) & ",3,False)"
rng2.Offset(0,1).Resize(,2).Formula = _
rng2.Offset(0,1).Resize(,2).Value
End Sub

--
Regards,
Tom Ogilvy

"Blobbies" wrote in message
...
Hi there

I have a template that I use for various sets of data that I receive from
time to time.

The data has a unique number, to which I have to enter in the associated
details manually.

The unique number however may feature many times in the data.

The template is set up to cope with 1000 records. I use the vLookup
function to populate the rows of data, according to the unique number.

I am sure that someone would be able to advise me on how I could create a
macro or VBA to do this, instead of just using the function.

i.e.

UNIQUE RECORDS

Number Name Address
0001 Eddie 2 Smith Street
0002 Oliver 34 Jones Street

Would need to populate:

Number Name Address
0002
0002
0001
0002
0001

Many thanks for taking the time to read this and for any suggestions that
may be forthcoming!!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default vlookup function

hi,

My data look like this ...( in reality there are 10k+ records)
A B

9999469 55-2092-1
CA968 55-2420-1
RWR81S5R23FR 91-0717-1
JANTX1N1202A CO715
TR291 TC338
CA968 91-1664-3
TR2375 9999469

in this see the value 9999469 it exists in the first column A and it exists
in the second column also B. I want to find whether a value in the second
colum exists in the second column or not...

i use the code...


Set myrng = Worksheets("Sheet1").Range("A:B")
i = WorksheetFunction.VLookup(ActiveSheet.Cells(1, 1), myrng, 2)
MsgBox i

if the value not exists i need to diaply i as "NO" otherwise "YES".....

i write the above code for only 1 value ie 9999469.....remaining thing i can
do it in a loop....thanks in advance...

With regds

Sunil.T

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default vlookup function


Hi Sunil

simply enter the following formula in the adjoing row, and copy down
Change the range to suit yourself.

=IF(ISNUMBER(MATCH(A1,$B$1:$B$7,0)),"Yes","No")


Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=36074



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default vlookup function

thanks toppers and tom

i've been at work since 3 a.m. this morning - is now 10 p.m. at night here,
so i haven't tried your suggestions yet.

i will though and i really appreciate the time you guys put in to help!!

cheers





"Blobbies" wrote:

Hi there

I have a template that I use for various sets of data that I receive from
time to time.

The data has a unique number, to which I have to enter in the associated
details manually.

The unique number however may feature many times in the data.

The template is set up to cope with 1000 records. I use the vLookup
function to populate the rows of data, according to the unique number.

I am sure that someone would be able to advise me on how I could create a
macro or VBA to do this, instead of just using the function.

i.e.

UNIQUE RECORDS

Number Name Address
0001 Eddie 2 Smith Street
0002 Oliver 34 Jones Street

Would need to populate:

Number Name Address
0002
0002
0001
0002
0001

Many thanks for taking the time to read this and for any suggestions that
may be forthcoming!!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to combine Combo Box function with Vlookup function KH Excel Worksheet Functions 2 April 5th 10 01:24 PM
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION CHAIM Excel Worksheet Functions 1 July 27th 05 09:10 PM
how do I write a vlookup function within an iserror function so t. JBLeeds Excel Worksheet Functions 2 March 16th 05 10:30 AM
I want to use Vlookup function and AND function in a single formu. prakash Excel Worksheet Functions 3 January 25th 05 07:11 AM


All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"