+ Reply to Thread
Results 1 to 3 of 3

Compare column with cell

  1. #1
    Registered User
    Join Date
    02-24-2010
    Location
    asdf
    MS-Off Ver
    Excel 2003
    Posts
    1

    Compare column with cell

    I currently have this setup in a worksheet
    A B C D F
    ON01 1100 1150 990 ???
    ON02 1200 1300
    ON03 900 1000
    ON04 300 800

    Now what i am trying to accomplish is this.

    Column cell B is the minimum number for Column cell A
    Column cell C is the max number for Column cell A

    I want D1 to check which column row it is between(D1:C1,D2:C2,D3:C3...etc), and if D1 is greater then Bx and Less then Cx, I want F1 to display what ever row Ax is in that D1 value is between.

    The example above should return ON03 to F1 becasue D1 is 990 and it matches the range which is between B3:C3:

    So IF D1 > Bx And D1<Cx Display Ax in F1

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Compare column with cell

    If you don't mind using a helper column, take a look at the attached and see if this works for you.

    Formula in helper cell and copied down the column

    =AND($D$1>=B1,$D$1<=C1)

    Formula in F1

    =INDEX(A1:A4,MATCH(TRUE,G1:G4,0))
    Attached Files Attached Files
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Compare column with cell

    For a single cell approach - assuming there is only one valid match:

    F1: =LOOKUP(2,1/((B1:B4<=D1)*(C1:C4>=D1)),A1:A4)

    If there are multiple matches the above would return the last match, to return the first:

    F1: =INDEX(A1:A4,MATCH(1,INDEX((B1:B4<=D1)*(C1:C4>=D1),0),0))

    Pending volume of data points Palmetto's suggestion of using helpers is a sensible one - neither of the above suggestions are what you would term "efficient" with big data sets.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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