You can do this for the example you are showing, if I interpret it correctly. If not, you can change things a bit to fit
your function has three parameters:
The first comes from row 12 of the current column. The second comes from column D of the current row. The third comes from column two to the right of the current row. I assume that Payment1 is already a named variable?
Place the cursor on line F21 and then define this name
MyFunction = (Payment1 - F $ 12) * 12 + ($ D21-H21)
This will result in settings from the locations shown.
To understand this better, switch to RC mode and enter the formula as:
=(Payment1 - R12C)*12 + (RC4-RC[+2])
Now you can distribute the formula through F coloumn
= My_function
and it will always use the values in the corresponding column F12 Dxx and column Hxx
If you drag the formula to the next column, it will use G12, Dxx and Ixx
If you want to change the formula, edit it in the namespace
This is a general exception to the rule in which you cannot use UDF without VBA in Excel. Often in Excel, the things you want to use as the “arguments” for a function are actually in fixed places (rows or columns) that you can relate to.
For example, you often want to execute udf in the cell on the left
Thus, udf, giving the cuber of the cell to the left, will be a named formula:
Cuberoot = (RC [-1]) ^ (1/3)
Or in form a1, position the cursor in B1 and type = (A1) ^ (1/3) And Excel will convert it internally to RC form
For three arguments - use three columns
It works and does not suffer from the volatility problem mentioned in the evaluation question ()
Yes, I know this is an old post, but it can help someone with the same problem.
Bob J.