How can I match a random number with closest number from sequence?
For instance, if I have the following list (my list is 255 numbers long):
A B ..7 Red 1.2 Orange 2.6 Brown 3.5 Grey 4.3 Yellow 5.5 Red Orange and I enter 3.2 into C1, I would like for d1 to return 3.5 (the closest number to 3.2 from sequence). That's the main thing (remember I have 255 of these and I think excel only lets you nest 7 if's) Once the correct match is match, I would also like to display the color it is associated with (each of the 255 combinations has its own color) So, after it finds the 3.5 match from the 3.2 input, I would like another cell to display Grey. As another example, an input of 5.0 would return 5.5 and Red Orange. Thanks for the help. |
How can I match a random number with closest number from sequence?
Here's one way =INDIRECT(ADDRESS(ROW(A1:A6)+MATCH(MIN(ABS(C1-A1:A6)),ABS(C1-A1:A6),0)-1,COLUMN(A1:A6)+1)) VBA Noob -- VBA Noob ------------------------------------------------------------------------ VBA Noob's Profile: http://www.excelforum.com/member.php...o&userid=33833 View this thread: http://www.excelforum.com/showthread...hreadid=567664 |
How can I match a random number with closest number from sequence?
Sorry, should of said it's an array formula so need to enter with Ctrl + Shift + Enter VBA Noob -- VBA Noob ------------------------------------------------------------------------ VBA Noob's Profile: http://www.excelforum.com/member.php...o&userid=33833 View this thread: http://www.excelforum.com/showthread...hreadid=567664 |
How can I match a random number with closest number from sequence?
Try this formula =INDEX(B1:B255,MATCH(MIN(ABS(C1-A1:A255)),ABS(C1-A1:A55),0)) confirmed with CTRL+SHIFT+ENTER -- daddylonglegs ------------------------------------------------------------------------ daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486 View this thread: http://www.excelforum.com/showthread...hreadid=567664 |
How can I match a random number with closest number from seque
Thanks for the help! Both of these methods worked perfectly.
|
All times are GMT +1. The time now is 01:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com