+ Reply to Thread
Results 1 to 4 of 4

vlookup to a a non continuous range

Hybrid View

  1. #1
    Registered User
    Join Date
    06-17-2016
    Location
    Australia
    MS-Off Ver
    7
    Posts
    1

    vlookup to a a non continuous range

    I am sure I saw a similar post, and pretty sure this cant be done, but hoping some one has worked out a workaround. Small example:

    100-110 = a
    114 = b
    120-130 = c

    Unfortunately I have a table where the gaps in numbers are some times 800 long and I dont want to be pasting 800 values to make gap continoius. The outcome I need is:

    if the cell entry is between 100 to 110, I want to returm a value of a
    if the cell entry is 113, I want to return an error or #na
    if the cell etnry is between 120-130, I want to return a cell value of c in another cell

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: vlookup to a a non continuous range

    Welcome to the forum.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,496

    Re: vlookup to a a non continuous range

    Short story: no, you can't do that. VLOOKUP takes a fourth parameter; this is FALSE if you want an EXACT match and TRUE if you want an inexact match. For the first option, you would need every entry that was valid with the appropriate return value. Any entries not present would return #N/A. For the second option, you would just list, in ascending order, the upper values in a range together with the return values for the range. But that won't give you #N/A for "missing" entries because there won't be any missing entries.

    You could probably do it with a User Defined Function (UDF) but that's a different question.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: vlookup to a a non continuous range

    Quote Originally Posted by velotrout View Post

    100-110 = a
    114 = b
    120-130 = c

    if the cell entry is between 100 to 110, I want to returm a value of a
    if the cell entry is 113, I want to return an error or #na
    if the cell etnry is between 120-130, I want to return a cell value of c in another cell
    You can use nested If functions...

    =IF(AND(A1>=100,A1<=110),"A",IF(A1=114,"B",IF(AND(A1>=120,A1<=130),"C",#N/A)))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Replies: 0
    Last Post: 02-20-2012, 05:42 PM
  2. Continuous Range
    By DSC174 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2005, 01:05 PM
  3. [SOLVED] Sum function for non-continuous range
    By Anne Troy in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-06-2005, 03:05 PM
  4. Sum function for non-continuous range
    By Antje in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-14-2005, 09:05 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