+ Reply to Thread
Results 1 to 6 of 6

Incrementing nth Smallest number by one with conditions (inside INDEX function)

  1. #1
    Registered User
    Join Date
    05-06-2020
    Location
    Brasil
    MS-Off Ver
    365
    Posts
    4

    Incrementing nth Smallest number by one with conditions (inside INDEX function)

    Hello!

    I'm having trouble to get the nth smallest number with a criteria. You can see the table i made attached at imgur. I'm dealing with rain data and i need to retrieve de date and time of occurence of the 5 events that are more intense. To do so, I created a combination with the INDEX, SMALL IF and ROW functions (the formula is written in brasilian so you may see the translated terms in the picture i sent). It's this hard because I need to deal with data that can be equal to each other but occur in different dates. The only way i've managed to do it is by getting the nth smallest row associated with the rain data and retrieving the date in which it occured. It worked out nicely but i have to increment the "nth" term manually when there are subsequential equal values, as I cannot find a way to increase them automatically. In the picture you can see the formula in cell and I need cell J19 to have the smallest and J20 the second smallest, and, for example, in K27:K30, to have the 4 smallest values. I haven't managed to do it with aggregate or row functions (i tried =AGGREGATE(14,3,(H30=H26:H29)/(H30=H26:H29)*(LIN(H30)-LIN(H26)),1)
    to count the number of equal data and retrieve me the result but it isn't working out)

    Excel image:
    I can't attach the picture or attach a link so you can find it in imgur and McqONCR

    Can anyone please give me some tips? I've tried a lot and can't manage to find the result myself.

    Thanks!!!

  2. #2
    Registered User
    Join Date
    05-06-2020
    Location
    Brasil
    MS-Off Ver
    365
    Posts
    4

    Re: Incrementing nth Smallest number by one with conditions (inside INDEX function)

    As I haven't been able to attach the image, for those who can't oppen imgur, the formula I used to retrieve the date is
    =INDEX(Dados!$E$2:$E$8929,SMALL(IF(B3=Dados!$J$2:$J$8929,ROW(Dados!$J$2:$J$8929)-1,""),1))
    This gives me the date for the smallest row where a rain data occur and, if there are two equal datas, i need the second smallest row to get the next date otherwise the date will always be the same.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Incrementing nth Smallest number by one with conditions (inside INDEX function)

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    05-06-2020
    Location
    Brasil
    MS-Off Ver
    365
    Posts
    4

    Re: Incrementing nth Smallest number by one with conditions (inside INDEX function)

    Hello,
    Thanks for the quick response !
    I can't attach the table, there's an error. I tried zipping it (because it's a 7kB table) and it still won't work so i'm attaching an image.
    Attached Images Attached Images

  5. #5
    Registered User
    Join Date
    05-06-2020
    Location
    Brasil
    MS-Off Ver
    365
    Posts
    4

    Re: Incrementing nth Smallest number by one with conditions (inside INDEX function)

    Sorry for so many posts! I've reduced the table to a small amount of data. In this one, you can see the problems i'm having in columns B and N (red cells). I need a formula that allows me to detect when the rain subsequential values are equal and, when they are, increase the Nth smallest row number by one.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,554

    Re: Incrementing nth Smallest number by one with conditions (inside INDEX function)

    The formulas on Planilha2 of the file seem to reference a separate file instead of the data on Planilha1.
    Assuming that the formulas should reference the data from Planilha1:
    1. The formula for B3:B7 is: =LARGE(Planilha1!J$2:J$1596,ROW(A1))
    2. The formula for D3:D7 is: =INDEX(Planilha1!E$2:E$1596,AGGREGATE(15,6,(ROW(E$2:E$1596)-ROW(E$1))/(Planilha1!J$2:J$1596=B3),COUNTIFS(B$3:B3,B3)))
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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] Smallest number through INDEX MATCH
    By anggiemelisa in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-24-2019, 11:13 AM
  2. Nesting and Index and Match function inside an IF function
    By breckleeb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-29-2016, 11:06 AM
  3. Replies: 2
    Last Post: 06-03-2015, 02:50 PM
  4. [SOLVED] Using ROW function inside of both an Indirect and Index function returns #VALUE
    By xandermacleod in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-11-2012, 06:22 PM
  5. Incrementing Index for paste function with each use of a macro
    By Iantaylora in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2012, 10:44 AM
  6. Index/Match function inside an array
    By tittiot in forum Excel General
    Replies: 2
    Last Post: 01-20-2010, 09:48 PM
  7. INDEX MATCH 3rd SMALLEST NUMBER
    By sleazyfish in forum Excel General
    Replies: 1
    Last Post: 07-24-2009, 04:59 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