I'm new to VBA, and I have a question, i.e I have a mathematical function 1 + 2x¹ + 3x² + 4x³ + ... +10x⁹ and I need to resolve it into two ways:
- I can use raising operations(analog pow in Pascal) and IF statement;
- without rising operations and IF statement...
I have tried this one:
Public Function test(x)
test = 1 + 2*x^1 + 3*x^2 + 4*x^3 + 5*x^4 + 6*x^5 + 7*x^6 + 8*x^7 + 9*x^8 + 10*x^9
End Function
but I think it returns the wrong answer - 2441406 with calling =test(5)
So can anyone give any advice, or help with my problem?
10x9do you mean 10 times x to the power of 9 or what?). Also, forgive me but I am not sure what you mean byIF statament; 2 - without rising operations and IF statement.*multiplication operator between the two operands. E.g.10 * x ^ 9. I don;t really understand your posted code because it gives a syntax error.