Consulting

Results 1 to 5 of 5

Thread: Solved: VLOOKUP AND COLUMN FUNCTION

  1. #1

    Solved: VLOOKUP AND COLUMN FUNCTION

    Good afternoon guys This one has me stopped.
    I am using the VLookup command to retreive data from Sheet2 and put the data in sheet1. I can put a hold on everything in the VLookup command using the $ sign. How do I change the column function so the
    VLookup command moves from column to column?
    Example. In sheet1 Column B I have =VLookup*$A$,Sheet2!$A$2:$C$50,2,0) When I move across the the row how do I get the column command to go from 2, to 3 and 3 to 4 and 4 to 5?? I have a lot of columns to cover so is there a way to advance the column command
    as I move across the ss?? Thanks for any help with this.
    Max

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Instead of using 2 as the offset, use Column() plus/minus X to suit.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3

    Vlookup and Column fuction

    The data is in sheet2. The VLookup fuction is in Sheet1.
    The first VLookup is in Sheet1 B2.
    I will be going from B2 thru Z2.
    The Column fuction has to change 52 times.
    Example: =Vlookup($A$1,Sheet2!$A$2:$Z$2,2,0)
    =Vlookup($A$1,Sheet2!$A$2:$Z$2,3,0)
    =Vlookup($A$1,Sheet2!$A$2:$Z$2,4,0)
    Everything stays the same except the Column function changes each time.
    The last Column function will be 26
    If you show me how to get started I can go to 100 if I wish.
    Max

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    =Vlookup($A$1,Sheet2!$A$2:$Z$2,column()+1,0)
    Just change the +1 to suit your relative column positions.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5

    VLookup and column function

    MDMACKILLOP Thanks, you hit that one on the head. The formula
    works great. You guys have helped me out of many jams.
    Keep up the good work.
    Max

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •