+ Reply to Thread
Results 1 to 7 of 7

Thread: VBA Lookup

  1. #1
    Registered User
    Join Date
    12-30-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    43

    Question VBA Lookup

    I'm trying to write script that basically act as a lookup. I think I need to use the "find" and "offset" functions with a loop and an if statement to stop it when the list is finished. I cannot use a general non vba lookup function because of the way the data is displayed.

    Goal: Determine the "Average FTE Based on Section Count" based on the Client

    Any help would be greatly appreciate.
    Attached Files Attached Files
    Last edited by TYork; 12-30-2009 at 01:44 PM.

  2. #2
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: VBA Lookup

    Are you actually using Excel 2008 as your profile suggests?
    So long, and thanks for all the fish.

  3. #3
    Registered User
    Join Date
    12-30-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: VBA Lookup

    I use 2007, sorry. I need to change that.

  4. #4
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: VBA Lookup

    If your layout is always the same, you could use this formula in C3:
    =IF(ISNA(MATCH(B3,'STAFF ANALYSIS'!F:F,0)),INDEX('STAFF ANALYSIS'!G:G,MATCH(B3,'STAFF ANALYSIS'!G:G,0)+6),INDEX('STAFF ANALYSIS'!F:F,MATCH(B3,'STAFF ANALYSIS'!F:F,0)+6))
    and copy it down.
    So long, and thanks for all the fish.

  5. #5
    Registered User
    Join Date
    12-30-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: VBA Lookup

    That would work for the example I presented but there are instances in the actuals where it can go 20 columns deep. Even though I use 2007 it would need to be compatible with 2003 because that is what most in my office use.

  6. #6
    Forum Moderator romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Alibi
    MS-Off Ver
    All
    Posts
    8,262

    Re: VBA Lookup

    How's this?
    Attached Files Attached Files
    So long, and thanks for all the fish.

  7. #7
    Registered User
    Join Date
    12-30-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: VBA Lookup

    This is perfect and a lot more efficient than what I had drawn up in pseudocode. I appreciate the help as I try to build up my scripting abilities. Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0