+ Reply to Thread
Results 1 to 6 of 6

Is VLookup the best solution?

  1. #1
    Registered User
    Join Date
    07-23-2005
    Location
    Northampton & London, England
    MS-Off Ver
    2003
    Posts
    9

    Is VLookup the best solution?

    One of the reports I run produces a list of products, discounts and the number sold. However, the products and discounts are coded to 2 characters each. Some products can have any discount applied, some cannot. I can only get VLookup to work for products that can be discounted.

    e.g:
    AA:00 correctly returns 'Pie' (:00 = undiscounted)
    AB:02 correctly returns 'Pie [Child]'
    ZW:00 should return 'Soft Drink' but does not
    ZW:01 should return 'Tap Water' but does not

    I have tried to use ISNA in the formula, but it doesn't want to work! (I've attached a document to give you an idea of what I mean)
    =IF(ISNA(B3),VLOOKUP(B3,$G$3:$H$10,2),VLOOKUP(LEFT(B3,2),$G$3:$H$10,2)&VLOOKUP(RIGHT(B3,3),$G$3:$H$10,2))

    Your help would be much appreciated!
    Attached Files Attached Files

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: Is VLookup the best solution?

    You didn't write what version excel you use so I make solution with 2007:

    =IFERROR(VLOOKUP(B3;$H$3:$I$10;2;FALSE);VLOOKUP(LEFT(B3;2);$H$3:$I$10;2)&VLOOKUP(RIGHT(B3;3);$H$3:$I$10;2))
    Never use Merged Cells in Excel

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Is VLookup the best solution?

    Try:

    Please Login or Register  to view this content.
    in C3, copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    07-23-2005
    Location
    Northampton & London, England
    MS-Off Ver
    2003
    Posts
    9

    Re: Is VLookup the best solution?

    Thanks for the suggestions, but neither have worked. I'm using Excel 2003.

  5. #5
    Registered User
    Join Date
    07-23-2005
    Location
    Northampton & London, England
    MS-Off Ver
    2003
    Posts
    9

    Re: Is VLookup the best solution?

    Sorry - I copied the code incorrectly.

    Thanks for your help NBVC!
    Last edited by NBVC; 04-30-2009 at 07:40 AM. Reason: corrected spelling of my name.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: Is VLookup the best solution?

    Try this:

    =IF(ISNA(MATCH(B3;$G$3:$G$10;0));VLOOKUP(LEFT(B3;2);$G$3:$H$10;2)&VLOOKUP(RIGHT(B3;3);$G$3:$H$10;2);VLOOKUP(B3;$G$3:$H$10;2;FALSE))

+ 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