Find first occurence of specific data in a column.

G

Guest

I would like to be able to run a macro that will find the first occurence in
a column of specified data. There are multiple rows with 1.2005 then more
multiple rows with 2.2005 and so on. I need to locate the first instance of
1.2005, 2.2005 etc and return the value in a cell in the same row but an
adjacent column.
Many thanks.
 
T

Tom Ogilvy

Since your data is sorted then:
=vlookup(1.2005,A1:B2000,2,False)

in VBA

res = application.Vlookup(1.2005,Range("A1:B2000"),2,False)
 
D

Damien McBain

Ben said:
I would like to be able to run a macro that will find the first occurence
in
a column of specified data. There are multiple rows with 1.2005 then more
multiple rows with 2.2005 and so on. I need to locate the first instance
of
1.2005, 2.2005 etc and return the value in a cell in the same row but an
adjacent column.

just whack:

=if(a2=a1,"It changes here!","")

in cell b2 then copy it down
 
G

Guest

Problem solved!
Many thanks.

Tom Ogilvy said:
Since your data is sorted then:
=vlookup(1.2005,A1:B2000,2,False)

in VBA

res = application.Vlookup(1.2005,Range("A1:B2000"),2,False)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top