Forum Discussion
Dichotomy66
May 17, 2019Brass Contributor
Finding closest match to average of a subset of column values
I have for example(actual is 200 rows) Col1 Col2 Col3 DBNUM TYPE EQUITY 1 HHH 53 2 MHH 45 3 LMH 22 4 ...
- May 17, 2019
As for the first question I'd use AGGREGATE() instead of MIN() to filter only records with code (HHH)
=INDEX(MAIN[DBNUM], MATCH(1, (MAIN[TYPE]="HHH")* (ABS((AVERAGEIF(MAIN[TYPE],"HHH",MAIN[EQUITY])-MAIN[EQUITY]))= AGGREGATE(15,6,1/(MAIN[TYPE]="HHH")*(ABS(AVERAGEIF(MAIN[TYPE],"HHH",MAIN[EQUITY])- MAIN[EQUITY])),1)), 0))
SergeiBaklan
May 17, 2019Diamond Contributor
As for the first question I'd use AGGREGATE() instead of MIN() to filter only records with code (HHH)
=INDEX(MAIN[DBNUM],
MATCH(1,
(MAIN[TYPE]="HHH")*
(ABS((AVERAGEIF(MAIN[TYPE],"HHH",MAIN[EQUITY])-MAIN[EQUITY]))=
AGGREGATE(15,6,1/(MAIN[TYPE]="HHH")*(ABS(AVERAGEIF(MAIN[TYPE],"HHH",MAIN[EQUITY])- MAIN[EQUITY])),1)),
0))- Dichotomy66May 17, 2019Brass Contributor
SergeiBaklanAny thoughts on the Random idea?
- Dichotomy66May 17, 2019Brass Contributor
SergeiBaklanThanks Sergei, you are the Aggregate King! I suspected it was the solution but I still struggle with using it