Retrieving cell reference for value below threshold in conditional list

drquesh

New Member
Joined
Mar 7, 2018
Messages
2
Would be grateful for help adding a conditional filter to an array formula to find the maximum value up to a variable threshold in an unsorted list. I can do it for a whole list using help in other posts, but not for a conditional subset.


Example shown below. For each department, I want to find the name of the individual whose value is closest to or equal to, but not over, to a specific value for their department.

So, for department A with a threshold of 6.2, from the list of 5.6, 3.5 and 6.4, it returns row 2's name, Mike. I need the formula to give the results in cells G2 and G3.

ABCDEFG
1DeptNameValueDeptThresholdPerson
2AMike5.6A6.2Formula = Mike
3BSarah8.5B2.2Formula = Sandra
4ALindsey3.5
5BCatherine4.7
6BSandra2.2
7APaul6.4
8BGeoff3.3

<tbody>
</tbody>


I know this is likely to need an array formula using MATCH and INDEX, and probably MIN/MAXs given it is unsorted, but I haven't managed to add a conditional filter to the examples I have found that will work on a whole unsorted list.

For duplicates, I'm happy to just return the first result.

Thanks in advance for your help

Chris
[/HTML][/HTML]
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Book1
ABCDEFG
1DeptNameValueDeptThresholdPerson
2AMike5.6A6.2Mike
3BSaraj8.5B2.2Sandra
4ALindsey3.5
5BCatherine4.7
6BSandra2.2
7APaul6.4
8BGeoff3.3
Sheet1
Cell Formulas
RangeFormula
G2{=INDEX($B$2:$B$8,MATCH(MAX(IF($A$2:$A$8=$E2,IF($C$2:$C$8<=$F2,$C$2:$C$8))),$C$2:$C$8,0))}
Press CTRL+SHIFT+ENTER to enter array formulas.


WBD
 
Upvote 0
Row\Col
A​
B​
C​
D​
E​
F​
G​
H​
1​
DeptNameValueDeptThresholdPerson
2​
AMike
5.6
A
6.2
MikeChris
3​
BSarah
8.5
B
2.2
Sandra
4​
ALindsey
3.5
5​
AChris
5.6
6​
BCatherine
4.7
7​
BSandra
2.2
8​
APaul
6.4
9​
BGeoff
3.3

In G2 control+shift+enter, not just enter, copy across as far as needed, and down:
Rich (BB code):
=IFERROR(INDEX($B$2:$B$9,SMALL(IF($A$2:$A$9=$E2,IF($C$2:$C$9=MAX(IF($A$2:$A$9=$E2,IF($C$2:$C$9<=$F2,$C$2:$C$9))),
       ROW($B$2:$B$9)-ROW($B$2)+1)),COLUMNS($G2:G2))),"")
 
Upvote 0
Thank you both. Knew I had the right functions, but just couldn't crack the recipe. Really appreciate the help.
 
Upvote 0
Thank you both. Knew I had the right functions, but just couldn't crack the recipe. Really appreciate the help.

You need to evaluate the proposals with care. The first proposal will not only miss ties, but it will also fail under adverse conditions (e.g., hange C3 to 2.2).
 
Upvote 0
You need to evaluate the proposals with care. The first proposal will not only miss ties, but it will also fail under adverse conditions (e.g., hange C3 to 2.2).

From the original post:

For duplicates, I'm happy to just return the first result.

The solution provided does exactly as requested. The OP did not request all values in case of a tie. There's also no suggestion that there are no values that will match which I assume is the "adverse conditions". If that's the case then:

Code:
=IFERROR(INDEX($B$2:$B$8,MATCH(MAX(IF($A$2:$A$8=$E2,IF($C$2:$C$8<=$F2,$C$2:$C$8))),$C$2:$C$8,0)),"")

Entered as an array formula.

WBD
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
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