+ Reply to Thread
Results 1 to 4 of 4

VLOOKUP - Finding postage price vs Weight

  1. #1
    Registered User
    Join Date
    10-27-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2000
    Posts
    1

    VLOOKUP - Finding postage price vs Weight

    I'd like to calculate automatically the postage price of a parcel according to a weight table but there is a problem with vlookup.

    A B

    1 100g £1.83
    2 250g £2.16
    3 500g £2.60
    4 750g £2.99
    4 1000g £3.45

    Now if I use vlookup on this occasion for a 150g parcel, the price that will be returned is £1.83 as vlookup will return the nearest lower value to the 150g which is 100g. However, the postage for an 150g parcel is £2.16 instead as from 101g-250g the price is £2.16 according to the table.


    Is there a way of doing this other than a series of "IF" functions.
    If VLOOKUP could return the cell instead of the value of the cell perhaps I could add one cell down and find the value this way but I don't know how to do that.

    Any suggestions please ?

    Thanks
    Yanni
    Last edited by Yanni; 10-27-2009 at 01:55 PM.

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

    Re: VLOOKUP - Finding postage price vs Weight

    Try

    =INDEX(B1:B5,MATCH(TRUE,INDEX(A1:A5>=D1,0),0))

    where values in Column A are actually numbers...

    and D1 contains weight to lookup
    Last edited by NBVC; 10-27-2009 at 02:55 PM.
    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.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: VLOOKUP - Finding postage price vs Weight

    =LOOKUP(150,A1:A6,B2:B7) will return the correct answer

    To handle weights less than 100, add a row on top and fill the two new cells with 0's.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    10-05-2010
    Location
    So San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VLOOKUP - Finding postage price vs Weight

    I used the index example and it worked like a charm. Thank you for saving me hours of experimentation.

+ Reply to Thread

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