troglodyte
New Member
- Joined
- Sep 9, 2014
- Messages
- 11
Hi all,
I need help with (what I'm sure is!) a basic Index/Match problem which I can't wrap my head around.
I need to find the closest 'Fixed Value' (Column C) which relates to the list of 'Actual Values' (Column D) in column E. The other criteria here is that the value must come from the same Grouping, i.e. The value in cell D2 is in Group A, the closest value returned must also be in Group A (as determined by the letters in column B).
So far in E2 I have returned the closest value overall (for all groups) but not the one which is closest to a 'Fixed Value' from Group A. How can I amend my formula (seen below) in E2 so that I can return only the nearest number from the relevant group? A second point I'd possibly like to add is that I would want the name (in Column A) to be returned instead of the number.
Below is an example of what I have (I can't attach the file sadly).
[TABLE="width: 357"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Group[/TD]
[TD]Fixed Value[/TD]
[TD]Actual Value[/TD]
[TD]Closest Value[/TD]
[/TR]
[TR]
[TD]Harry[/TD]
[TD]A[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]156531[/TD]
[TD="align: right"]15665[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]B[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]466[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Charlie[/TD]
[TD]C[/TD]
[TD="align: right"]15665[/TD]
[TD="align: right"]132[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Henry[/TD]
[TD]D[/TD]
[TD="align: right"]651651[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Simon[/TD]
[TD]A[/TD]
[TD="align: right"]648[/TD]
[TD="align: right"]45618[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]D[/TD]
[TD="align: right"]351[/TD]
[TD="align: right"]156[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Larry[/TD]
[TD]D[/TD]
[TD="align: right"]984[/TD]
[TD="align: right"]168[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Marvin[/TD]
[TD]D[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]51[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Tim[/TD]
[TD]D[/TD]
[TD="align: right"]984561[/TD]
[TD="align: right"]681[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Jeremy[/TD]
[TD]A[/TD]
[TD="align: right"]894[/TD]
[TD="align: right"]3251[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Tom[/TD]
[TD]B[/TD]
[TD="align: right"]2516[/TD]
[TD="align: right"]259[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Pat[/TD]
[TD]B[/TD]
[TD="align: right"]5684[/TD]
[TD="align: right"]651[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam[/TD]
[TD]C[/TD]
[TD="align: right"]561[/TD]
[TD="align: right"]56[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dave[/TD]
[TD]C[/TD]
[TD="align: right"]656[/TD]
[TD="align: right"]353[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Many thanks,
I need help with (what I'm sure is!) a basic Index/Match problem which I can't wrap my head around.
I need to find the closest 'Fixed Value' (Column C) which relates to the list of 'Actual Values' (Column D) in column E. The other criteria here is that the value must come from the same Grouping, i.e. The value in cell D2 is in Group A, the closest value returned must also be in Group A (as determined by the letters in column B).
So far in E2 I have returned the closest value overall (for all groups) but not the one which is closest to a 'Fixed Value' from Group A. How can I amend my formula (seen below) in E2 so that I can return only the nearest number from the relevant group? A second point I'd possibly like to add is that I would want the name (in Column A) to be returned instead of the number.
Code:
=INDEX($C$2:$C$100000,MATCH(MIN(ABS($C$2:$C$100000-D2)),ABS($C$2:$C$100000-D2),0))
Below is an example of what I have (I can't attach the file sadly).
[TABLE="width: 357"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Group[/TD]
[TD]Fixed Value[/TD]
[TD]Actual Value[/TD]
[TD]Closest Value[/TD]
[/TR]
[TR]
[TD]Harry[/TD]
[TD]A[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]156531[/TD]
[TD="align: right"]15665[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]B[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]466[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Charlie[/TD]
[TD]C[/TD]
[TD="align: right"]15665[/TD]
[TD="align: right"]132[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Henry[/TD]
[TD]D[/TD]
[TD="align: right"]651651[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Simon[/TD]
[TD]A[/TD]
[TD="align: right"]648[/TD]
[TD="align: right"]45618[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]D[/TD]
[TD="align: right"]351[/TD]
[TD="align: right"]156[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Larry[/TD]
[TD]D[/TD]
[TD="align: right"]984[/TD]
[TD="align: right"]168[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Marvin[/TD]
[TD]D[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]51[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Tim[/TD]
[TD]D[/TD]
[TD="align: right"]984561[/TD]
[TD="align: right"]681[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Jeremy[/TD]
[TD]A[/TD]
[TD="align: right"]894[/TD]
[TD="align: right"]3251[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Tom[/TD]
[TD]B[/TD]
[TD="align: right"]2516[/TD]
[TD="align: right"]259[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Pat[/TD]
[TD]B[/TD]
[TD="align: right"]5684[/TD]
[TD="align: right"]651[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam[/TD]
[TD]C[/TD]
[TD="align: right"]561[/TD]
[TD="align: right"]56[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Dave[/TD]
[TD]C[/TD]
[TD="align: right"]656[/TD]
[TD="align: right"]353[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Many thanks,