+ Reply to Thread
Results 1 to 5 of 5

Search for Line Number between Ranges

  1. #1
    Forum Contributor
    Join Date
    05-15-2015
    Location
    Orlando, FL
    MS-Off Ver
    Office Standard 2016
    Posts
    266

    Search for Line Number between Ranges

    Hi Everyone,

    I have a spreadsheet that has a Schedule on one tab and a Register on another tab. Within the Schedule, columns B:C list cost code ranges (a starting number and an ending number). Column A list line numbers (1-40 as example). What I was looking to accomplish, was any time a cost code is listed on the "Register" tab, it would tell me the corresponding line number that cost code falls under. The complicated part is that everything is done in Ranges. So the actual cost code listed might not be on Column B or C, but it falls within the range.

    For example, if line 5 has a range of 21013200 and 21013210, and the Register list code 21013205, it would still return line 5 as this falls between those two numbers.

    I have attached a spreadsheet as an example to show what I'm trying to do. If this isn't possible, please let me know. Thanks everyone!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Search for Line Number between Ranges

    Try

    =SUMPRODUCT((Schedule!$A$8:$A$54)*(Schedule!$B$8:$B$54<=Register!A8)*(Schedule!$C$8:$C$54>=Register!A8))

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

    Re: Search for Line Number between Ranges

    Or ...

    =INDEX(Schedule!$A$8:$A$55,MATCH(1,(Schedule!$B$8:$B$55-A8<=0)*(Schedule!$C$8:$C$55-A8>=0),0))

    Enter with Ctrl+Shift+Enter.

  4. #4
    Forum Contributor
    Join Date
    05-15-2015
    Location
    Orlando, FL
    MS-Off Ver
    Office Standard 2016
    Posts
    266

    Re: Search for Line Number between Ranges

    This is returning a #Value for me. Would you be able to test in the Example sheet i have? Sorry for the delay in responding.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Search for Line Number between Ranges

    Another way.

    Try array entering this and filling down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

+ 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: 12
    Last Post: 06-22-2016, 01:11 PM
  2. Maximum number of ranges in an Excel 2010 line graph?
    By Carrfamily in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-31-2015, 04:47 PM
  3. VBA Code - Search text & search number & search qty and result - Urgent Please
    By naresh73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2014, 10:51 AM
  4. Search for a line in all Modules in a workbook and add extra line below
    By sans in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2013, 03:17 PM
  5. different line color for different ranges
    By hasters in forum Excel General
    Replies: 1
    Last Post: 01-06-2010, 08:57 PM
  6. [SOLVED] assigning ranks to number ranges:, what I am trying to do is turn ranges of scores
    By nikki8327 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-24-2005, 06:05 PM
  7. 2 data ranges shown on 1 line with 2 axis
    By Nadia in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-12-2005, 10: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