+ Reply to Thread
Results 1 to 3 of 3

Is there any formula to look for the next value provided by a condition?

  1. #1
    Registered User
    Join Date
    08-05-2014
    Location
    HK
    MS-Off Ver
    2010
    Posts
    13

    Is there any formula to look for the next value provided by a condition?

    Hi,

    I have lots of data like this:

    A B C D E F (Column)
    1 X1 John 2 John X1
    1 Y1 Peter 2 Peter Y1
    1 Z1 Ken 3 Ken Z1
    5 X2 John 6 John X2
    5 Y2 Peter 7 Peter Y2

    My situation is as follows:

    In column F, if D1 (i.e. 2) and E1= John, then use D1 to look for the closest value in column A, but not larger than 2. As such, F1 return the result "X1".
    if D5 (i.e. 7) and E15 = Peter, then use D5 to look for the closest value in column A, but not larger than 7. As such, F5 return the result "Y2"

    Is there any formula to put in columen F for my case?

    Thank you All!!

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Is there any formula to look for the next value provided by a condition?

    =INDEX(B$1:B$5,MATCH(MAX(IF(C$1:C$5=E1,A$1:A$5)*IF(A$1:A$5<=D1,1)),IF(C$1:C$5=E1,A$1:A$5)*IF(A$1:A$5<=D1,1),0))

    entered as an array formula (confirm with ctrl+shift+enter) in F1 and copied down (assuming your data is in A1:E5).

  3. #3
    Registered User
    Join Date
    08-05-2014
    Location
    HK
    MS-Off Ver
    2010
    Posts
    13

    Re: Is there any formula to look for the next value provided by a condition?

    hi ragulduy

    it works! thanks a lot, you save my world!!

    But, would you mind to tell/teach me the meaning of "MAX(IF(C$1:C$5=E4,A$1:A$5)*IF(A$1:A$5<=D4,1))" and why A$1:A$5 in the IF function can return a numeric value?

    Greatly appreciated!

    Ken

+ 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. [SOLVED] Formula in one cell that picks up another based on dates provided in the same sheet
    By s.tara91 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-16-2013, 12:58 AM
  2. Hello and thank you for the help provided in this forum!
    By processcker in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 08-08-2013, 08:10 PM
  3. [SOLVED] Help for if condition formula result only either hit or miss from mulitple condition
    By breadwinner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 07:29 AM
  4. Locking a cell that contains a formula that has provided a result
    By redders in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2010, 05:14 AM
  5. [SOLVED] How do I write a formula to color code based on dates provided or.
    By jaime in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-18-2005, 10:06 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