+ Reply to Thread
Results 1 to 4 of 4

Order of 3 numbers in a non ordered range

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    brazil
    MS-Off Ver
    Excel 2007
    Posts
    64

    Order of 3 numbers in a non ordered range

    I need some help.

    I have to find the order which 3 numbers (C2, C3 and C4) occurs in a non ordered range.

    See attached file.

    The question is that the match is not exact, it varies from -2 to +2 over C2, C3 and C4, like:
    AND(>(C2-2);<(C2+2)).

    In E2 I need to know the first number that appears on the range A2:A15, then in E3 the second and in E4 the third.

    The formula that make some sense (even if they don't work):
    =INDEX(A2:A15,MATCH(C2,AND(A2:A15>C3-2,A2:A15<C3+2),0),1)
    =INDIRECT("A"&MATCH(AND(>C2-2,<C2+2),A2:A15,0))

    Please, I'm really dazed!
    Attached Files Attached Files
    Last edited by dualaudio454252; 02-12-2014 at 10:42 PM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Order of 3 numbers in a non ordered range

    hi there. i tried to create a formula without helper columns, but i just couldn't think of any. my solution is to create an array formula in F2:
    =MATCH(1,($A$2:$A$15>=C2-2)*($A$2:$A$15<=C2+2),0)
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again. copy down to F4

    then in E2:
    =INDEX($C$2:$C$4,MATCH(SMALL($F$2:$F$4,ROWS(E$2:E2)),$F$2:$F$4,0))

    hope you get a better answer without the helper columns.
    Attached Files Attached Files

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Order of 3 numbers in a non ordered range

    interesting..but what happens with say 5 in cell a7 it meets both 3 and 7 requirements
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    06-19-2013
    Location
    brazil
    MS-Off Ver
    Excel 2007
    Posts
    64

    Re: Order of 3 numbers in a non ordered range

    Martindwilson, if 3 and 7 (+or-2) occurs in the same cell, the formula will show the same number (position) for each one, wich is a draw, and that's the way I want to be displayed.

    And thank you so, so, so much, Benishiryo!!!!!!!

    I've used your formula and it works perfectly!!!!
    I will do some adjust to make the numbers appear the way I want, cause there are cells to do it.
    That's enough for me!

    Thank you again!

+ 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: 5
    Last Post: 04-01-2013, 08:19 AM
  2. Is it possible to count some numbers in a range(Descending order range)
    By amitgurus in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2013, 10:59 AM
  3. Is it possible to count some numbers in a range(Descending order range)
    By amitgurus in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2013, 08:41 AM
  4. [SOLVED] How do you apply the int() in VBA in order to convert numbers stored as text to numbers
    By djaurit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 02:57 PM
  5. Replies: 3
    Last Post: 10-21-2005, 01:05 AM

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