Return first row value for first matched criterion

neil7722

New Member
Joined
Apr 1, 2017
Messages
6
Hey Guys,
Would really appreciate your help on this.
I have percentages sorted from low to high in rows. They might be repeated many times. My first row contains time slots. I want to return the first matched percentage and corresponding time slot for % greater than 67% and less than 99%
Eg:

Numbers14:3614:4214:4814:5415:0015:0615:1215:1815:2415:30TimePercentage
100%0%14%29%29%43%86%86%86%100%15:1286%
110%0%43%71%71%71%71%71%100%100%14:5471%

<colgroup><col width="64" span="14" style="width:48pt"> </colgroup><tbody>
</tbody>

For number 10, my first matching >67% criterion is 86% at 15:12, so I want to return the time 15:12 and % as 86%.
Similarly for 11, 71% occurred first at 14:54 so I want that value to be returned along with the %

Thanks in advanced.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Assuming that A1:N3 contains your posted data, try...

M2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=INDEX($B$1:$K$1,MATCH(1,IF(B2:K2>67%,IF(B2:K2<100%,1)),0))

N2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=INDEX(B2:K2,MATCH(1,IF(B2:K2>67%,IF(B2:K2<100%,1)),0))

Hope this helps!
 
Upvote 0
Awesome... works like a charm... Thanks a ton... you have been of a great help....



Assuming that A1:N3 contains your posted data, try...

M2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=INDEX($B$1:$K$1,MATCH(1,IF(B2:K2>67%,IF(B2:K2<100%,1)),0))

N2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=INDEX(B2:K2,MATCH(1,IF(B2:K2>67%,IF(B2:K2<100%,1)),0))

Hope this helps!
 
Upvote 0
You're very welcome. Actually, I just noticed that you did say...

...and less than 99%

...so hopefully you changed the formula accordingly.
 
Upvote 0
Your solution was exactly what I had in mind.. I wanted to have % upto 99%..

My actual goal was to get the 2nd highest % for my entire sheet.. I was struggling with the solution so I observed the data and found that for most of the cases.. my 2nd highest % fell between 68-99%. But there are a few cases where the case is different.

eg:
Numbers14:3614:4214:4814:5415:0015:0615:1215:1815:2415:30Actual outputTime%What I wantedTime%
3213%13%13%38%38%38%75%88%88%100%323:18:00 PM75%323:18:00 PM88%
1733%33%67%67%67%67%67%67%67%100%17#N/A#N/A172:48:00 PM67%
150%0%14%29%57%71%71%71%86%100%153:12:00 PM71%153:24:00 PM86%

<colgroup><col span="13"><col><col span="2"><col><col><col></colgroup><tbody>
</tbody>

But I can work with this if we cannot find a solution for the above..

You're very welcome. Actually, I just noticed that you did say...



...so hopefully you changed the formula accordingly.
 
Upvote 0
In that case, we can avoid array formulas, and simply use LARGE and INDEX/MATCH...

A1:O4

14:3614:4214:4814:5415:0015:0615:1215:1815:2415:30Time%
320.130.130.130.380.380.380.750.880.8813215:180.88
170.330.330.670.670.670.670.670.670.6711714:480.67
15000.140.290.570.710.710.710.8611515:240.86

<tbody>
</tbody>


O2, copied down:

=LARGE(B2:K2,2)

N2, copied down:

=INDEX($B$1:$K$1,MATCH(O2,B2:K2,0))

Hope this helps!
 
Upvote 0
Yep... this works too... Thank you!! :D
Actually I am glad I have solutions to both the approaches. I can now see which fits better for my analysis.

Thanks a ton. You have been of great help man!
 
Upvote 0
Ohh, there was one problem. If 100% is repeated more than once, as we see in my very first post, 2nd row... my value returns as 100%
Sending you more records for you to understand it...

0%0%9%45%64%73%82%91%100%100%
0%0%11%56%67%78%89%89%100%100%
0%13%50%63%75%88%88%100%100%100%
33%33%33%33%67%100%100%100%100%100%
50%50%50%50%50%100%100%100%100%100%
0%0%0%40%50%50%50%100%100%100%
0%75%100%100%100%100%100%100%100%100%
0%0%29%29%29%43%43%43%100%100%
0%50%50%75%100%100%100%100%100%100%
0%0%25%25%75%100%100%100%100%100%
20%20%20%40%80%80%80%100%100%100%
0%17%33%67%100%100%100%100%100%100%
20%20%60%80%100%100%100%100%100%100%

<colgroup><col width="64" span="10" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0
For the second largest unique value, try...

O2, copied down:

=LARGE(B2:K2,COUNTIF(B2:K2,LARGE(B2:K2,1))+1)

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,794
Members
449,048
Latest member
greyangel23

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