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

1. ## 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. ## 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
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. ## 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.

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.

5. ## 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.

6. ## 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.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### 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