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

Hello. I can't seem to get the below formula to work. Conceptually, I need
the Col_Index_Num field in the vlookup formula to be the current column +
3 - the value in cell C2. When I run the line below, I get a Sub or
Function not Defined error on Column(). So I'm guessing Column() is a
worksheet function and not vba code. Any ideas on how I can switch around?
Thanks!

ActiveCell.Formula = _
"=VLOOKUP($A$4,Data!$A$7:$Q$1000," & Column() + 3 -
Range("C2").Value & ",0)"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Vlookup help

ActiveCell.Column + 3 - Range("C2")

HTH

Die_Another_Day
Steph wrote:
Hello. I can't seem to get the below formula to work. Conceptually, I need
the Col_Index_Num field in the vlookup formula to be the current column +
3 - the value in cell C2. When I run the line below, I get a Sub or
Function not Defined error on Column(). So I'm guessing Column() is a
worksheet function and not vba code. Any ideas on how I can switch around?
Thanks!

ActiveCell.Formula = _
"=VLOOKUP($A$4,Data!$A$7:$Q$1000," & Column() + 3 -
Range("C2").Value & ",0)"


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

That is correct, column() is a worksheet formula.

One Possibility

ActiveCell.Formula = _
"=VLOOKUP($A$4,Data!$A$7:$Q$1000,Column() + 3 -" &
Range("C2").Value & ",0)"


or:

ActiveCell.Formula = _
"=VLOOKUP($A$4,Data!$A$7:$Q$1000," & _
activecell.column + 3 - Range("C2").Value & ",0)"


--
Regards,
Tom Ogilvy



"Steph" wrote in message
...
Hello. I can't seem to get the below formula to work. Conceptually, I
need the Col_Index_Num field in the vlookup formula to be the current
column + 3 - the value in cell C2. When I run the line below, I get a Sub
or Function not Defined error on Column(). So I'm guessing Column() is a
worksheet function and not vba code. Any ideas on how I can switch
around? Thanks!

ActiveCell.Formula = _
"=VLOOKUP($A$4,Data!$A$7:$Q$1000," & Column() + 3 -
Range("C2").Value & ",0)"



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
If (Vlookup 0) working, but what if Vlookup cell does not exist Steve Excel Worksheet Functions 18 November 18th 09 07:33 PM
VLookUp - Does the VLookUp return the exact information? Cpviv Excel Worksheet Functions 2 October 28th 08 09:57 AM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
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
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


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