Hello,
I would like to write excel vba codes to help me find some values in an Excel table and do an interpolation between the values. I tried Bard, but I couldn't get it to understand what i need. Your help is very much appreciated.
I have a lookup table like this:
I will enter Parameter A and Parameter B.
The code needs to find the rows where the first column values are closest to Parameter A. For example, if Parameter A = 210, it should find all the rows where the 1st column is equal to 200 and 220.
Then for each of these set of rows (first set is where the 1st column is equal to 200 and the second set is where the 1st column is equal to 220), the code should find the two closest numbers to Parameter B, and return the value in column 3 (Result column).
So there should be 4 outputs at this point.
Then the code should do an interpolation between the two outputs in each set, so that it gives 1 output for each set... and then it should do another interpolation to find the value corresponding to the actual Parmeter A.
Eventually there needs to be 1 output value.
If Parameter A or Parameter B are exactly equal to the values in column 1 or column 2 of the lookup table, then no need to do an interpolation.
Can you help me with this task please?
Thanks!
I would like to write excel vba codes to help me find some values in an Excel table and do an interpolation between the values. I tried Bard, but I couldn't get it to understand what i need. Your help is very much appreciated.
I have a lookup table like this:
A | B | Result |
180 | 29.2035 | 0.100001 |
180 | 29.884 | 0.199999 |
180 | 33.5401 | 0.299989 |
180 | 38.6137 | 0.400004 |
180 | 44.6787 | 0.499991 |
200 | 31.2836 | 0.100001 |
200 | 31.7116 | 0.199999 |
200 | 35.0952 | 0.299989 |
200 | 39.8694 | 0.400004 |
200 | 45.609 | 0.499991 |
220 | 33.2044 | 0.100001 |
220 | 33.4297 | 0.199999 |
220 | 36.5857 | 0.299989 |
220 | 41.1143 | 0.400004 |
220 | 46.5736 | 0.499991 |
240 | 34.9716 | 0.100001 |
240 | 35.0398 | 0.199999 |
240 | 38.0141 | 0.299989 |
240 | 42.3263 | 0.400004 |
240 | 47.566 | 0.499991 |
I will enter Parameter A and Parameter B.
The code needs to find the rows where the first column values are closest to Parameter A. For example, if Parameter A = 210, it should find all the rows where the 1st column is equal to 200 and 220.
Then for each of these set of rows (first set is where the 1st column is equal to 200 and the second set is where the 1st column is equal to 220), the code should find the two closest numbers to Parameter B, and return the value in column 3 (Result column).
So there should be 4 outputs at this point.
Then the code should do an interpolation between the two outputs in each set, so that it gives 1 output for each set... and then it should do another interpolation to find the value corresponding to the actual Parmeter A.
Eventually there needs to be 1 output value.
If Parameter A or Parameter B are exactly equal to the values in column 1 or column 2 of the lookup table, then no need to do an interpolation.
Can you help me with this task please?
Thanks!