3
$\begingroup$

I have

data = {{817, 501}, {818, 549}, {819, 562}, {820, 534}, {821, 534}, {822, 535}, {823, 516}};

How to find argument "822" for 535 (which is the highest in given range) setting range of maximum to 820-823?

$\endgroup$
1
  • 1
    $\begingroup$ What about {823, 516} the last item? $\endgroup$
    – Syed
    Nov 3 '21 at 12:14
3
$\begingroup$

SortBy[Select[data, 820 <= #[[1]] <= 823 &], #[[2]] &][[-1, 1]]

$\endgroup$
2
$\begingroup$

Another possibility

MaximalBy[Select[data, 820 <= First[#] <= 823 &], Last]
(* {{822, 535}} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.