+ Reply to Thread
Results 1 to 2 of 2

Formula to check whether a number falls within a number range and returning the rows

  1. #1
    Registered User
    Join Date
    01-07-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    64

    Formula to check whether a number falls within a number range and returning the rows

    I have a worksheet with several columns and rows of data. I have a search engine at the top where if I type in a value, it gives me all the rows which contain that value for that column category. One column contains serial number ranges. For example, each cell in column F (Serial Number) look like this:

    F1: 140000-141150
    F2: 141151-150000

    What I require is that if I type in serial number 140020 in my search cell, it should return row 1. I tried using the LEFT, RIGHT and MID functions but they only work if I type in the range ends (i.e. 140000, 141150, 141151, 150000 etc). Any help would be appreciated! Thanks!

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Formula to check whether a number falls within a number range and returning the rows

    With my search value in A1 I used this formula:

    =MAX(INDEX(ROW(F1:F10)*(A1>=IFERROR(VALUE(LEFT(F1:F10,FIND("-",F1:F10)-1)),9999999))*(A1<=IFERROR(VALUE(MID(F1:F10,FIND("-",F1:F10)+1,255)),0)),0))

    Confirmed with Ctrl-Shift-Enter, not just Enter.

    Expand the range F1:F10 as required. It doesn't matter if you go above the number of rows of data you have (i.e. if you change the ranges to F1:F1000 and you only have 700 rows of data it will still work).

+ 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