I want to write a macro on excel to subtract a number from many different data points and compare the results. For example, 3 of the data points are 3400, 1700, and 850. If the the number is 1200, I want to write a macro that will find 3400 - 1200, 1700 - 1200, and 850 - 1200 and then determine which has the smallest positive difference. A snag is that I want to discard 850- 1200 because the answer is negative, so the correct answer would be 1700 - 1200.
I'm stuck and not even sure how to go about starting, any help would be greatly appreciated.
I'm stuck and not even sure how to go about starting, any help would be greatly appreciated.
Last edited: