Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Update Vlookup lookup_value

This code is started in E3 and places the formula in the cells as needed. It
references B3 "RC[-3]" for the lookup_value. Is there a way to write this
formula so that it will always have the lookup_value point to the B column
even if the code were started in F3 "RC[-4]"or G3 "RC[-5]"...etc?

Sub Formulas()
For j = 1 To 5
ActiveCell.FormulaR1C1 = _

"=IF(RC[-3]="""","""",IF(ISERROR(VLOOKUP(RC[-3],WorkSheet!R1C2:R43C3,2,FALSE
)),0,VLOOKUP(RC[-2],WorkSheet!R1C2:R43C3,2,FALSE)))"
ActiveCell.Offset(1, 0).Select
Next j
End Sub

Thanks,
Phil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Update Vlookup lookup_value

RC2

would represent the same row, column 2 (B).



Phil Floyd wrote:

This code is started in E3 and places the formula in the cells as needed. It
references B3 "RC[-3]" for the lookup_value. Is there a way to write this
formula so that it will always have the lookup_value point to the B column
even if the code were started in F3 "RC[-4]"or G3 "RC[-5]"...etc?

Sub Formulas()
For j = 1 To 5
ActiveCell.FormulaR1C1 = _

"=IF(RC[-3]="""","""",IF(ISERROR(VLOOKUP(RC[-3],WorkSheet!R1C2:R43C3,2,FALSE
)),0,VLOOKUP(RC[-2],WorkSheet!R1C2:R43C3,2,FALSE)))"
ActiveCell.Offset(1, 0).Select
Next j
End Sub

Thanks,
Phil


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Update Vlookup lookup_value

Very Good! Thank you.

Phil

"Dave Peterson" wrote in message
...
RC2

would represent the same row, column 2 (B).



Phil Floyd wrote:

This code is started in E3 and places the formula in the cells as

needed. It
references B3 "RC[-3]" for the lookup_value. Is there a way to write

this
formula so that it will always have the lookup_value point to the B

column
even if the code were started in F3 "RC[-4]"or G3 "RC[-5]"...etc?

Sub Formulas()
For j = 1 To 5
ActiveCell.FormulaR1C1 = _


"=IF(RC[-3]="""","""",IF(ISERROR(VLOOKUP(RC[-3],WorkSheet!R1C2:R43C3,2,FALSE
)),0,VLOOKUP(RC[-2],WorkSheet!R1C2:R43C3,2,FALSE)))"
ActiveCell.Offset(1, 0).Select
Next j
End Sub

Thanks,
Phil


--

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 on partial lookup_value Faraz A. Qureshi Excel Discussion (Misc queries) 8 June 12th 09 05:57 AM
vlookup lookup_value text natk Excel Worksheet Functions 3 May 5th 09 07:54 PM
vlookup lookup_value ATIHelp Excel Worksheet Functions 5 July 18th 07 07:12 AM
Vlookup(lookup_value) TSulit Excel Worksheet Functions 1 February 22nd 07 04:23 PM
vlookup:same lookup_value, different returns Biff Excel Worksheet Functions 2 December 16th 05 01:00 AM


All times are GMT +1. The time now is 09:00 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"