+ Reply to Thread
Results 1 to 7 of 7

Formula for looking up an exact or greater number...

Hybrid View

  1. #1
    Registered User
    Join Date
    05-18-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    23

    Question Formula for looking up an exact or greater number...

    I'm trying to build a spreadsheet to work out some trends from all sorts of data and am looking for a way to automate this process.

    I want to be able to lookup an exact or greater than value as specified by one cell, that is then searched for in a range/column of figures. When this number is found to report where it appeared.

    Sorry if my explanation is confusing. I'll try it a different way:

    Find next number in range (B1:B50) that is greater than or equal to C1, output which row it first appeared in. i.e. A5, A20?

    Thanks.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Formula for looking up an exact or greater number...

    =match($c$1;b1:b14;1)+1
    Never use Merged Cells in Excel

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702

    Re: Formula for looking up an exact or greater number...

    This formula will give the row number (within the range)

    =MATCH(TRUE,INDEX(B1:B50>=C1,0),0)

  4. #4
    Registered User
    Join Date
    05-18-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Formula for looking up an exact or greater number...

    Quote Originally Posted by daddylonglegs View Post
    This formula will give the row number (within the range)

    =MATCH(TRUE,INDEX(B1:B50>=C1,0),0)
    Thankyou this does part of it! This tells me how many rows from the start of the range are counted until the value is met or exceeded. Can the Cell ID be displayed rather than the amount of 'moves' down the range?

    Or better yet from the row within the range returned, can the cell and it's row be copied to a new worksheet?

    Thanks again. Most helpful.

  5. #5
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: Formula for looking up an exact or greater number...

    Try this modification of DLL's code:

    =ADDRESS(MATCH(TRUE,INDEX(B1:B50>=C1,0),0),2)
    The 2 at the end of the function refers to column B- if you have the data in another column, change as appropriate (c=3, D=4 etc)

    Edit: Just noticed a possible problem- if the values in column B aren't in order this could give a wrong result.
    Last edited by deadlyduck; 05-18-2009 at 06:16 PM.
    Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702

    Re: Formula for looking up an exact or greater number...

    Quote Originally Posted by deadlyduck View Post
    if the values in column B aren't in order this could give a wrong result.
    Shouldn't be an issue.....

    If you want the formula in another sheet then assuming that your data is on a worksheet called data you can use this formula to get the location, without "hardcoding" the column;

    =CELL("address",INDEX(data!B1:B50,MATCH(TRUE,INDEX(data!B1:B50>=data!C1,0),0)))

    If you just want the value itself

    =INDEX(data!B1:B50,MATCH(TRUE,INDEX(data!B1:B50>=data!C1,0),0))

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Formula for looking up an exact or greater number...

    hm, match($c$1;b1:b14;-1) should work, but I don't know why it gives me error .-S

    In that case this migh be better...

    =IF(ISNA(MATCH($C$1;B1:B14;0));MATCH($C$1;B1:B14;1)+1;MATCH($C$1;B1:B14;0))

+ 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