+ Reply to Thread
Results 1 to 4 of 4

vlookup return first matching value which is not zero

  1. #1
    Registered User
    Join Date
    05-08-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    4

    vlookup return first matching value which is not zero

    Hello,

    Any help with this one would be MUCH appreciated - thanks in advance!

    I need to use a vlookup to match a code in column 1 and return the price from column 2.

    There are multiple rows with the same code in column 1. The table is sorted, so all of the same codes are bunched together.

    However, some of the prices in column 2 are zero.

    I do not want a zero returned. I want the first non-zero price returned which matches the code I am looking for.

    Example:

    Code Price
    ABC 0.00
    ABC 0.00
    ABC 3.40
    ABC 5.24

    When doing a vlookup for code ABC, I would want the price 3.40 returned.

    Can anyone help please?

    Thanks!

    Rob.

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: vlookup return first matching value which is not zero

    Try this ...

    =INDEX(B2:B10,MATCH(1,INDEX((A2:A10="ABC")*(B2:B10<>0),0),0))

  3. #3
    Registered User
    Join Date
    05-08-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: vlookup return first matching value which is not zero

    Works perfectly, thanks!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: vlookup return first matching value which is not zero

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Return Highest Matching Value for vlookup
    By levitt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-27-2015, 03:35 PM
  2. Vlookup to return multiple values for duplicate matching keys
    By abc_123excel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-04-2013, 09:58 PM
  3. Replies: 2
    Last Post: 06-12-2012, 06:39 PM
  4. vlookup, how return the matching value to 2 column?
    By s_zabihi in forum Excel General
    Replies: 1
    Last Post: 12-01-2011, 04:18 PM
  5. Replies: 4
    Last Post: 02-11-2011, 08:59 AM
  6. Return multiple matching lines using VLOOKUP?
    By Nick Robinson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2011, 02:39 PM
  7. Vlookup & return all values by matching 2 cells
    By PY_ in forum Excel General
    Replies: 2
    Last Post: 09-12-2010, 11:08 AM

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