Hi all
I have to find a way to solve this problem. I have a column with different numbers for example x1 x2 x3..x1000, and a specific range of 125 y1 y2 y3.. y125 numbers.
i want to find which x number is closest to a y number. So i was thinking to do y1-x1= and y2-x1= and y3- x1= and so on. the smallest positive number will be my correct answer. So in the below example the answer is 4848 and i want vba to bring me back in a specific column the Y number which in this case is 300000. Feel free to ask anything...waiting for some suggestions.
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl64, width: 64"]Y[/TD]
[TD="class: xl64, width: 64"]X[/TD]
[TD="class: xl64, width: 64"]Y-X[/TD]
[/TR]
[TR]
[TD="class: xl63"]282000[/TD]
[TD="class: xl63"]295152[/TD]
[TD="class: xl63"]-13152[/TD]
[/TR]
[TR]
[TD="class: xl63"]288000[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]-7152[/TD]
[/TR]
[TR]
[TD="class: xl63"]288000[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]-7152[/TD]
[/TR]
[TR]
[TD="class: xl63"]300000[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]4848[/TD]
[/TR]
[TR]
[TD="class: xl63"]300800[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]5648[/TD]
[/TR]
</tbody>[/TABLE]
I have to find a way to solve this problem. I have a column with different numbers for example x1 x2 x3..x1000, and a specific range of 125 y1 y2 y3.. y125 numbers.
i want to find which x number is closest to a y number. So i was thinking to do y1-x1= and y2-x1= and y3- x1= and so on. the smallest positive number will be my correct answer. So in the below example the answer is 4848 and i want vba to bring me back in a specific column the Y number which in this case is 300000. Feel free to ask anything...waiting for some suggestions.
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl64, width: 64"]Y[/TD]
[TD="class: xl64, width: 64"]X[/TD]
[TD="class: xl64, width: 64"]Y-X[/TD]
[/TR]
[TR]
[TD="class: xl63"]282000[/TD]
[TD="class: xl63"]295152[/TD]
[TD="class: xl63"]-13152[/TD]
[/TR]
[TR]
[TD="class: xl63"]288000[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]-7152[/TD]
[/TR]
[TR]
[TD="class: xl63"]288000[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]-7152[/TD]
[/TR]
[TR]
[TD="class: xl63"]300000[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]4848[/TD]
[/TR]
[TR]
[TD="class: xl63"]300800[/TD]
[TD="class: xl63"][/TD]
[TD="class: xl63"]5648[/TD]
[/TR]
</tbody>[/TABLE]