Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel VBA - getPosition UDF
Hello,
I have a column of decimal numbers, and I need to compare my numbe with the column to find out where my number fits in. Once I know wher my number fits in, I can perform some calculations on my number. Her is my data: OD Titre 3.815 262144 2.912 131072 1.554 65536 0.426 32768 0.084 16384 0.043 8192 Assume my number is 3.5. Notice 3.5 is not in the list, so I want t find out where it would go if it were in the list. I want to write getPosition function to do this. After I find out where my number would go, if it were in the list, need to perform the following calculations: A=(sample OD-low OD)/(high OD-low OD) Titre sample=(A*(high titre-low titre)) + low titre The "low OD", "high OD", "low titre", and "high titre" values are al relative to where my number is in the list. So for 3.5, low OD = 2.912, high OD = 3.815, low titre = 131072, hig titre = 262144. Could someone please help me with writing a VB function to do this, a I do not know where to start. Thanks -- Message posted from http://www.ExcelForum.com |