Hi,
I would like to create a User Defined Function (UDF) from a complex calculation in an excel sheet.
Basically I have 5 cells which are calculated like this: “=IF(IF(($E$2-B5)<(B6-B5);($E$2-B5)*C6;(B6-B5)*C6)<0;0;IF(($E$2-B5)<(B6-B5);($E$2-B5)*C6;(B6-B5)*C6))”
Whereby $E$2=Input value
The content of the formula is not important, just to illustrate that it is a complex function
And then the output result is the sum of these 5 cells with IF functions
Now I would like to have something like this: customfunction(Input value)=output value
- I could translate this complex formula entirely in VBA and create a UDF from there directly... but this is rather cumbersome. Furthermore, I'm not a VBA expert (I just now the basics).
- Better would be if I could create a UDF directly from this excel sheet. So I just tell excel to put the (input) in cell $E$2 and then return me the output value of the calculation
Is there a way to achieve this?
Thx
I would like to create a User Defined Function (UDF) from a complex calculation in an excel sheet.
Basically I have 5 cells which are calculated like this: “=IF(IF(($E$2-B5)<(B6-B5);($E$2-B5)*C6;(B6-B5)*C6)<0;0;IF(($E$2-B5)<(B6-B5);($E$2-B5)*C6;(B6-B5)*C6))”
Whereby $E$2=Input value
The content of the formula is not important, just to illustrate that it is a complex function
And then the output result is the sum of these 5 cells with IF functions
Now I would like to have something like this: customfunction(Input value)=output value
- I could translate this complex formula entirely in VBA and create a UDF from there directly... but this is rather cumbersome. Furthermore, I'm not a VBA expert (I just now the basics).
- Better would be if I could create a UDF directly from this excel sheet. So I just tell excel to put the (input) in cell $E$2 and then return me the output value of the calculation
Is there a way to achieve this?
Thx