Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Offset VLOOKUP data by one row - example in message

I'm currently using the following code:

Dim lastRow9 As Long
lastRow9 = Worksheets("Working Sheet").Cells(Rows.Count,
"B").End(xlUp).Row
Range("a2").Formula = "=IF(ISNA(VLOOKUP(RC[1],tbl,
3,FALSE)),"""",VLOOKUP(RC[1],tbl,3,FALSE))"
Range("A2").AutoFill Destination:=Range("A2:A" & lastRow9)

Current Results
Results:
Column A Column B
Armstrong Jason Brenner
Armstrong Jack Kimball
Armstrong Sue Mitchell
Armstrong Lola Lumbar
Armstrong Genis Pinkerton

Kelly Jill Adler
Kelly Kim Gonzales
Kelly Lilly Lopez
[and so forth]

WHAT I'M LOOKING FOR:

Column A Column B
Armstrong Jason Brenner
Armstrong Jack Kimball
Armstrong Sue Mitchell
Armstrong Lola Lumbar
Armstrong Genis Pinkerton
Armstrong
Kelly Jill Adler
Kelly Kim Gonzales
Kelly Lilly Lopez
Kelly
[and so forth]
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Offset VLOOKUP data by one row - example in message

First, your formula is really in R1C1 reference style. You should use
..formulaR1C1 (even though excel/VBA can be forgiving).

And you can fill the entire range with that formula in one fell swoop:

Dim lastRow9 As Long
lastRow9 = Worksheets("Working Sheet").Cells(Rows.Count, "B").End(xlUp).Row
Range("a2:a" & lastRow9).FormulaR1C1 _
= "=if(rc[1]="""","""",IF(ISNA(VLOOKUP(RC[1],tbl,3,FALSE))," _
& """"",VLOOKUP(RC[1],tbl,3,FALSE)))"



S Himmelrich wrote:

I'm currently using the following code:

Dim lastRow9 As Long
lastRow9 = Worksheets("Working Sheet").Cells(Rows.Count,
"B").End(xlUp).Row
Range("a2").Formula = "=IF(ISNA(VLOOKUP(RC[1],tbl,
3,FALSE)),"""",VLOOKUP(RC[1],tbl,3,FALSE))"
Range("A2").AutoFill Destination:=Range("A2:A" & lastRow9)

Current Results
Results:
Column A Column B
Armstrong Jason Brenner
Armstrong Jack Kimball
Armstrong Sue Mitchell
Armstrong Lola Lumbar
Armstrong Genis Pinkerton

Kelly Jill Adler
Kelly Kim Gonzales
Kelly Lilly Lopez
[and so forth]

WHAT I'M LOOKING FOR:

Column A Column B
Armstrong Jason Brenner
Armstrong Jack Kimball
Armstrong Sue Mitchell
Armstrong Lola Lumbar
Armstrong Genis Pinkerton
Armstrong
Kelly Jill Adler
Kelly Kim Gonzales
Kelly Lilly Lopez
Kelly
[and so forth]


--

Dave Peterson
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
VLOOKUP and OFFSET CEG Excel Worksheet Functions 3 September 8th 08 07:16 PM
vlookup with offset? d0711 Excel Worksheet Functions 5 August 15th 08 07:23 PM
How can I use OFFSET and VLOOKUP together DavidMM Excel Discussion (Misc queries) 1 April 2nd 08 04:58 AM
vlookup and offset Rob M. Excel Worksheet Functions 3 December 2nd 05 01:10 AM
Vlookup then OFFSET over and down mendozalaura Excel Worksheet Functions 3 August 24th 05 12:32 AM


All times are GMT +1. The time now is 11:39 AM.

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

About Us

"It's about Microsoft Excel"