
:max_bytes(150000):strip_icc()/openoffice-calc-570674c53df78c7d9e983c2e.png)
The rest should work fine with an IF statement.

What I can't figure out how to do is to sequentially read the values from the temperature column into the function. once the correct value is found, use the data from this row to interpolate the correct pressure and set the function equal to this value. Repeat until the value is greater than the value from page 1.ģ. If it is less discard it and get the value of the next cell in the column. compare it to the temperature value from the 1st page. get the temperature value of the first cell of the temperature column.Ģ. The value of the function will then be the resulting pressure value.ġ. So this would be a simple function with 3 inputs (the known temperature which is a value in a cell on the 1st page, the column number that contains the temperature data on page 2, and the column number that contains the pressure data on page 2). For instance, the model may know the temperature of saturated ammonia at a given time, from that information it will need to find the pressure from the 2nd page. I want to be able to interpolate data from this 2nd page into the model on the 1st page. On the second page I have listed the thermodynamic properties of saturated ammonia (the 1st col is temperature, the 2nd is pressure at that temperature, etc for the other properties). I am constructing a model of a thermodynamic process on the first page of my spreadsheet. Let me explain exactly what I am trying to do: All the examples that I can find seem to be for much more complicated things that what I am trying to do. I really don't think that the function that I am trying to write should be very complicated, but I can't seem to make it work. Service = createUnoService( ".FunctionAccess" )Īfter reading your code, I think perhaps that I am trying to mis-use the Offset function. I found some example macro functions that used these commands, but they seemed to have no effect on the operation of the macro function that I am trying to write:ĭim service as object, sheet as object, cell as object Strangly, the COS function works fine in a macro, but SQRT doesn't and neither does OFFSET. I know that offset works, because it works when I just use it in a formula, but it won't work when I try to use it in a macro function. All the data is entered into calc, but in order to read it I need to be able to write a function that uses the 'offset' function from the list of regular calc functions. I need to write a function to interpolate thermodynamic data from a chart. I have searched everywhere for examples but I can't find any that work. I have been using OO for 3 years and I love it, but finally my inabilty to figure out how to write user-defined functions in calc is about to send me back to Microsoft.
