+ Reply to Thread
Results 1 to 5 of 5

Function for conditional sorting of data

  1. #1
    Registered User
    Join Date
    04-26-2010
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Function for conditional sorting of data

    I had a question regarding a fix I am in while trying to analyze a data. Here's what I am lookin for.

    Column A Column B Column C
    14 6331
    14 8164
    14 4731
    14 6416
    14 8106
    15 4764
    15 6218
    15 6256
    15 6372
    16 6422
    16 4829
    16 4941
    16 4963
    17 6212
    17 6371
    18 6582
    18 6642
    18 8143
    19 6349
    19 6611
    19 4710
    20 4797
    20 4815
    20 4831
    20 6217
    14 6227
    14 6364
    14 6383

    If I put in a value,(say 14) in cell C1, I want all the values in column B corresponding to 14,15,and 16 (in column A) in column D. I think it has something to do with index and match with an if function. It would be really helpful if someone can help me with a function which gives me the desired result. Please find the attached spreadsheet for your reference.
    Thank you in advance.
    Attached Files Attached Files
    Last edited by daniel24; 04-26-2010 at 08:47 PM. Reason: poor thread tite

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Function for conditional sorting of data

    So is the criteria anything that is less than or equal to the value you enter in C1 +3?

    If so,

    in C2, enter:

    =IF(A2+0<=$C$1+3,COUNT(C$1:C1),"")

    copied down

    Then in D1 enter:

    =MAX($C$2:$C$285)

    in D2:

    =IF(ROWS($A$1:$A1)>$D$1,"",INDEX($B$2:$B$285,MATCH(ROWS($A$1:$A1),$C$2:$C$285,0)))

    copied down as far as you need.

    Adjust ranges to suit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    04-26-2010
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Function for conditional sorting of data

    Thanks a ton. This is exactly what I was looking for. I really appreciate your quick reply. Thanks again.

  4. #4
    Registered User
    Join Date
    04-26-2010
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Function for conditional sorting of data

    Hi there,

    Thank you for all your help. I have one more question which might seem to be a little stupid. What if I want to pull out data with some other criteria. Say if I put 17 in C1, I want all the values in Column B corresponding to 15,16,and 17.

    Thanks in advance.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Function for conditional sorting of data

    Sorry.. misinterpreted...

    So, in C2:

    =IF(AND(A2+0<=$C$1,A2+0>=$C$1-2),COUNT(C$1:C1),"")
    Last edited by NBVC; 04-26-2010 at 10:21 PM.

+ 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