+ Reply to Thread
Results 1 to 4 of 4

Vlookup and sort

  1. #1
    Registered User
    Join Date
    05-14-2009
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    10

    Vlookup and sort

    I have a worksheet that lists job numbers acting sort of as primary key. I use several if statements and vlookups to get other info pertaining to that job from another sheet.

    My problem is, one group prefers the jobs to be arranged by job number. Another group prefers the order to be based on possession date of the job (which is manually entered). I have the jobs arranged by job number as it's easier for me that way.

    When I try to sort the list based on the possession date, the vlookup nested within if statements stop working. the lookup reference doesn't change accordingly to the row where the job falls into.

    Any ideas?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Vlookup and sort

    It's hard to say for sure without seeing the sheet, and without a description of what is the incorrect behavior you see. But it sounds like you are using VLOOKUP with three arguments, which requires the data to be sorted (by job number, in your particular case). If so, add FALSE as a fourth argument, which requires an exact match regardless of how the data is sorted.
    Last edited by 6StringJazzer; 05-05-2010 at 01:19 PM. Reason: clarified sorting issue
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-14-2009
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Vlookup and sort

    Thanks for the reply and I apologize for not being specific.

    Here's an example of my formula:
    =IF(ISNA(VLOOKUP(E184,'sales price'!$A:$D,3,FALSE)),AI184,VLOOKUP('WIP Bank Detail'!E184,'sales price'!$A:$D,3,FALSE))

    I am using false as a 4th argument because to make sure I get the exact match.

    However, after I do an ascending sort based on a date column, the formula becomes:
    =IF(ISNA(VLOOKUP(E197,'sales price'!$A:$D,3,FALSE)),AI197,VLOOKUP('WIP Bank Detail'!E203,'sales price'!$A:$D,3,FALSE))

    Note that the lookup reference only changes at the first vlookup but the next vlookup doesn't seem to work.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Vlookup and sort

    I can't tell from what you posted what the problem is. Can you attach the workbook? I would want to see where the data is, how it's being sorted. Be sure and include details about how you sort. Do you sort a whole worksheet, or only certain columns?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1