Trying to find the second occurrence in a row.

JoeSw

New Member
Joined
Aug 10, 2018
Messages
5
Hi there, I've had a problem where I have a row of percentages and I need to find the second occurrence of a percentage that is under 40%. E.g. if I have two rows like this
JanFebMarchAprilMay
56%44%39%25%99%

<tbody>
</tbody>



Then I would like it to return April. I have found lots of ways for finding a second occurrence for rows but not for columns.


Bonus question: I was also wondering if anyone smarter than me could work out a good way to find out if there was an instance of three months in a row where the percentage was 40% above the instance of the percentage you have found previously that is found below 40%.

e.g. with the example above if you find the 2nd instance of a percentage that is below 40% which would be April (23%) then it would search down the row for an instance where there were three percentages in a row that were at least 63% or above.

Thanks so much!

Joe
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
With your sample data in A1:E2
and
G2: an upper limit...... 40%

Here are two approaches:
ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (insted of just pressing ENTER)
Code:
H2: =INDEX(A1:E1,SMALL(IF(A2:E2 < G2,COLUMN(A2:E2)),2))<g2,column(a2:e2)),2))[ code]
Regular formula (no C+S+E)
Code:
H2: =INDEX(A1:E1,SMALL(INDEX(COLUMN(A2:E2)*(A2:E2 < G2),0),2+COUNTIF(A2:E2,">"&G2)))<g2),0),2+countif(a2:e2,">
Remove the spaces from those formulas....This forum mis-interprets the original formulas when the spaces are not posted.
Does that help</g2),0),2+countif(a2:e2,"></g2,column(a2:e2)),2))[>
 
Last edited:
Upvote 0
For the same set-up described by Ron, another standard-entry formula is
Code:
=INDEX(A$1:E$1,AGGREGATE(15,6,(COLUMN(A2:E2)-COLUMN(A2)+1)/(A2:E2<G2),2))
 
Upvote 0
Hi,

Thanks both of you. So I have tried to use both of your suggestions but it still responded with an erroneous month so I was thinking of giving you the exact data that I am working with. There are some blanks so I am not sure if that is what is throwing the formulae off. Do you know if your suggestions look from left to right or from right to left?

Example:

Aut 12Spr 13Sum
13
Aut
13
Spr
14
Sum
14
Aut
14
Spr
15
Sum
15
Aut
15
Spr
16
Sum
16
Aut
16
Spr
17
Sum
17
Aut 17Spr 18
10.4%11.9%7.8%57.9%100%100%100%100%

<tbody>
</tbody>


So with the working formula I would expect it to bring Aut14 back as the second month below 40%.

Thanks again,

Joe
 
Upvote 0
There are some blanks ..
That does make a diffence because blanks are treated as zero, which of course is less than 40%. :)

Try this version of my suggestion.

Excel Workbook
ABCDEFGHIJKLMNOPQ
1Aut 12Spr 13Sum 13Aut 13Spr 14Sum 14Aut 14Spr 15Sum 15Aut 15Spr 16Sum 16Aut 16Spr 17Sum 17Aut 17Spr 18
210.40%11.90%7.80%57.90%100%100%100%100%
3
4Limit40%
52nd ColAut 14
2nd occurrence
 
Last edited:
Upvote 0
That does make a diffence because blanks are treated as zero, which of course is less than 40%. :)

Spreadsheet Formulas
CellFormula
B5=INDEX(A$1:Q$1,AGGREGATE(15,6,(COLUMN(A2:Q2)-COLUMN(A2)+1)/((A2:Q2<B4)*(A2:Q2<>"")),2))

<tbody>
</tbody>

<tbody>
</tbody>

Dear Peter,

Thank you so much, it works perfectly. I wish I could say I understood it however, I at least understand how to use it!
 
Upvote 0

Forum statistics

Threads
1,221,527
Messages
6,160,342
Members
451,638
Latest member
MyFlower

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top