Ask Your Question

x=Power(x,y) not working in Basic

asked 2020-01-03 23:04:57 +0200

Slowflight gravatar image

updated 2020-07-11 20:26:00 +0200

Alex Kemp gravatar image

Slowly working out calculations, but became stumped when it appear that =Power(x,y) does not seem to work. Dialog box pops up "BASIC runtime error. Sub-procedure or function procedure not defined."

It works fine in the spreadsheet, but I need it's operation in the function to pass back a single result.

edit retag flag offensive close merge delete


If you use a BASIC user defined function, then you should provide the macro code, so that the code could be inspected, tested and analyzed. Otherwise stick with @mauricio's advice to use the power function of LibreOffice.

Opaque gravatar imageOpaque ( 2020-01-03 23:45:43 +0200 )edit

Spreadsheet functions are not Basic functions. Sometimes some Basic functions have same names as spreadsheet functions, but that is coincidence. Generally you need to use FunctionAccess service in a macro to have access to the spreadsheet functions, e.g. like described here.

Mike Kaganski gravatar imageMike Kaganski ( 2020-01-04 00:08:22 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-01-03 23:15:46 +0200

edit flag offensive delete link more



Quoting @Mike Kaganski (from the comment on the question): "Sometimes ... Basic functions have same names as spreadsheet functions, ..."
But neither the same (mathematical) function will always have the same name as a spredsheet function and in Basic (if it exists at all in both worlds) nor can we be sure that functions existing under a specific name in Basic and in Calc are the same thing in both cases. Some are working slightly different. In at least one really "dangerous" case two equally named functions mean very different things. And the case lies in the the field under discussion here:
The LOG() function in Calc has an optional second parameter for the base which defaults to 10 while the Log() function in Basic uses the base e (2.718...). The second one is also called the "natural logarithm" and is also available in Calc, but as LN().
(The EXP() in ...(more)

Lupp gravatar imageLupp ( 2020-01-04 01:26:09 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-01-03 23:04:57 +0200

Seen: 155 times

Last updated: Jan 03 '20