If I understand your request correctly, you don't need VBA to accomplish the
task.
1. Insert a new column to the left of column A. If the data in column M (used
to be column L) begins in row 5, then in A5 enter this formula: =M5 . Copy
this formula down in column A for as many rows as there is data in column M.
2. In N5, enter this formula: =VLOOKUP(ROUND(MAX(M:M)/2,0),A:B,2,FALSE)
- You may not need or want to round MAX(M:M)/2
- I'm not clear whether you want the maximum value or the minimum value. The
formula above is for the maximum value; just replace MAX with min to get the
minimum value.
- The above approach works if column M always includes the maximum value AND a
value which is half that amount. If you want the closest value to MAX(M:M)/2
when there is no exact match you have to do a couple things:
A. Step 1 as above, but then sort the data in ascending order by the new
column A.
B. In the formula in step 2 above, replace FALSE with TRUE.